Skip to content

Instantly share code, notes, and snippets.

View dominykas's full-sized avatar

Dominykas Blyžė dominykas

View GitHub Profile
var config = module.exports;
config["reduced-test-case"] = {
rootPath: ".",
environment: "browser",
sources: [
"dostuff.js"
],
tests:[
"test.js"
@dominykas
dominykas / output.txt
Created August 1, 2013 13:10
req.params get overwritten
For http://localhost:3000/1 the following output will be produced:
Matched /:id
[ id: '1' ]
Matched /*
[ '1' ]
Timeout in /:id
[ '1' ]
Notice how req.params inside the /:id handler has changed.
@dominykas
dominykas / README.md
Created March 18, 2013 08:08
Firefox has a bug with zoom and media queries

Test case files:

  • container.html: IFRAME, 720px wide
  • mq.html should display:
    • 'Matching: default', when screen is <719px wide
    • 'Matching: min-width:719px', when screen is =719px wide
    • 'Matching: min-width:720px', when screen is >719px wide

In Firefox:

  • just mq.html works as expected (I think... too hard to repro exact circumstances)
  • container.html works as expected at 100% zoom
obj.method(arg, options, function(err, value){
if (err) {
// handle or rethrow
}
doSomethingWith(value);
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Invoice</title>
<style>
body {
font-family: sans-serif;
width: 640px;
margin: 0 auto;
@dominykas
dominykas / README.md
Created November 15, 2012 08:49
Function to use rem units, unless forced to use pixels

In IE specific stylesheet set $rem-to-px: 16px; and then in your ordinary stylesheets use rem(X) - this will produce Xrem for normal browsers and (X*16)px for IEold.

See also: http://jakearchibald.github.com/sass-ie/

@dominykas
dominykas / README.md
Created October 24, 2012 16:50
Enlarge click areas with pseudo elements
  • Works (ish) on all modern browsers and even on old browsers, such as IE8 or Android 2.3
  • IE8 doesn't support :target, so selected link won't change color
  • IE8/9 refuse to add pseudo elements around the buttons
  • iOS, unlike anything on Android, refuses to apply :hover after touching a span/button - thus we have to use :target (works for links, span/button requires JS)
  • I don't recall if it's possible to hack around the :hover limitation on iOS with tabindex and :focus... it had issues for certain.
@dominykas
dominykas / messyMess.js
Created October 23, 2012 00:39
What should the order be?
var Q = require("q");
var promise = Q.resolve("ok");
promise
.then(function(v){
console.log("then1");
})
.fin(function(){
console.log("fin1");
@dominykas
dominykas / expected.txt
Created October 22, 2012 23:46
.fin() without a .then() breaks ordering
then1
then2
fin1
fin2
fin3
@dominykas
dominykas / promiseKeeper.js
Created September 15, 2012 18:19
Q promise tracker
var noop = function(){};
// remove existing Q (hopefully it has no state...)
delete require.cache[require.resolve('q')];
// remove freezing so we can modify Q
var origFreeze = Object.freeze;
Object.freeze = noop;
// require Q and restore freezing
var Q = require('q');