Quantcast
Channel: User hurrymaplelad - Stack Overflow
Browsing index pages (41 articles)
↧

How do I prepend to a short python list?

list.append() appends to the end of a list. This explains that list.prepend() does not exist due to performance concerns for large lists. For a short list, how do I prepend a value?

View Article


Answer by hurrymaplelad for Depend on a branch or tag using a git URL in a...

Solution 1From the npm docs, using a git URL:https://github.com/<user>/<project>.git#<branch>https://github.com/<user>/<project>.git#feature\/<branch>Don't use...

View Article


Depend on a branch or tag using a git URL in a package.json?

Say I've forked a node module with a bugfix and I want to use my fixed version, on a feature branch of course, until the bugfix is merged and released. How would I reference my fixed version in the...

View Article

Does Varnish-devicedetect cookie based User-agent override require vary:...

varnish-devicedetect lets me return different responses based on User-agent:...elsif (req.http.User-Agent ~ "(?i)ipad") { set req.http.X-UA-Device = "tablet-ipad"; }elsif (req.http.User-Agent ~...

View Article

Closest ancestor matching selector using native DOM?

Is anybody working on a jQuery.closest() equivalent in the DOM api?Looks like the Selectors Level 2 draft adds matches() equivalent to jQuery.is(), so native closest should be much easier to write. Has...

View Article


Object.keys() complexity?

Anyone know the time-complexity of ECMAScript5's Object.keys() in common implementations? Is it O(n) for n keys? Is time proportional to the size of the hash table, assuming a hash implementation?I'm...

View Article

Answer by hurrymaplelad for How to test client-side code with NodeUnit

nodeunit-browser-tap+Testling is another option if you're set on nodeunit.The Testling npm package gets you command line output for tests run in a local browser.Testling.com gets you free cross browser...

View Article

Answer by hurrymaplelad for How to test client-side code with NodeUnit

Karma runner has a nodeunit adapter to run nodeunit tests in browsers and PhantomJS. Here's an example test entrypoint and Gruntfile using Browserify to run tests written in CommonJS modules (exports).

View Article


Type expression describing the string literal union of enum names?

Given:class Color(Enum): RED = 1 GREEN = 2 BLUE = 3Is there a type expression Foo such that:Foo[Color] = Literal["RED", "GREEN", "BLUE"]

View Article


How to tell if a name is a tag, bookmark, or named branch?

Given a nice string labe that works with hg show (ex: hg show stable), how can I determine if stable is a tag name, a bookmark name, or a named branch?

View Article

Are ES6 template literals faster than string concatenation?

Does HTML code generation run measurably faster in modern browsers when using string concatenation or template literals in ES6?For example:String concatenation"<body>"+"<article>"+"<time...

View Article

How do I compile coffeescript before publishing to NPM?

I wrote a simple module in CoffeeScript, but I want to publish the compiled JavaScript to NPM. I don't want to manually run the coffee command each time, that's too much typing and I'll probably forget...

View Article

Answer by hurrymaplelad for How do I get the directory where a Bash script is...

$_ is worth mentioning as an alternative to $0. If you're running a script from Bash, the accepted answer can be shortened to:DIR="$( dirname "$_" )"Note that this has to be the first statement in your...

View Article


Can I Vary on a custom header?

I'm bucketing User-Agents by device using something like varnish-devicedetect and storing the result in X-UA-Device on the request and the response. I've seen several recommendations to vary on...

View Article

Do browsers merge form action querystring params with fields?

Consider this form:<form method="GET" action="/signup?foo=1"><input type="hidden" name="bar" value="2"/><input type="submit"/></form>Will browsers reliably request...

View Article


Image may be NSFW.
Clik here to view.

Answer by hurrymaplelad for Do browsers merge form action querystring params...

No.JS Fiddle suggests Chrome will discard foo=1, and request /signup?bar=2.

View Article

Does position: fixed create a new stacking context for z-indicies?

The z-index spec makes no special mention of position: fixed, but this fiddle orders elements differently on Chrome 24. Does setting position: fixed create a new stacking context for child elements?

View Article


When would I use a Hack dict over a PHP array?

The docs are pretty light. The interface looks almost identical to an array.When should I prefer a dict?

View Article

Loading Google Maps API V3 asynchronously with dojo.io.script fails silently

Smushing Google's asynchronous loading docs into dojo's asynchronous loader yields: dojo.io.script.get({ url: 'http://maps.googleapis.com/maps/api/js', jsonp: 'callback', content: { sensor: 'false' },...

View Article

Image may be NSFW.
Clik here to view.

Answer by hurrymaplelad for Improving graphviz layout

TikZ generates beautiful graph layouts. You can use a manual layout that lets you specify the minimum of hints, or you can ask for automatic layout. Defaults are good, and hooks exist to tweak to...

View Article
Browsing index pages (41 articles)


Latest Images