Skip to content

Instantly share code, notes, and snippets.

@antris
antris / application.js
Created April 21, 2015 08:34
IntelliJ IDEA "go to definiton" bug
var {functionA, functionB} = require('./module')
functionA() // hitting cmd+B does not go to the definition
@antris
antris / gist:a39554e01ccdc243f17c
Created March 1, 2015 11:09
History browsing
var React = require('react')
var Immutable = require('immutable')
var Bacon = require('baconjs')
var NextPiecesView = require('./views/nextPiecesView')
var {worldStream} = require('./playField')
var PlayField = require('./views/playFieldView')
var input = require('./input')
var history = Immutable.List.of()
# No more templates: the power of abstraction in CoffeeScript and Underscore
## Terse syntax for creating DOM elements
$('div') # Find div elements in DOM
$('<div>') # Create a div element, detached from DOM
## Creating DOM trees
$('<article>').append(
$('<h1>').text('My blog post'),
$('<p>').text("
@antris
antris / .profile
Created January 18, 2012 07:12
Show git or Mercurial branch in command prompt
hg_branch() {
test -e .hg/branch && echo " hg:$(cat .hg/branch)"
}
git_branch() {
test -e .git && git branch | grep \* | awk '{ printf " git:" substr($0, index($0,$2)) }'
}
export PS1='\h:\w$(hg_branch)$(git_branch) $ '
@antris
antris / gist:1369797
Created November 16, 2011 10:46
JavaScript Date comparisons are WEIRD
new Date() > new Date() // false
new Date() < new Date() // false
new Date() == new Date() // false
new Date() >= new Date() // true
new Date() <= new Date() // true