Skip to content

Instantly share code, notes, and snippets.

@kumavis
kumavis / gist:5600958
Last active December 17, 2015 11:19
More strange javascript behaviour

comparators

null < 1
//=> true
null < 0
//=> false
undefined < 1
//=> false
undefined < 0
//=&gt; false
@kumavis
kumavis / ember-stalkable.coffee
Last active December 15, 2015 14:19 — forked from Fordi/examples.js
ember-stalkable examples
###
"Stalkable" objects can be watched for any and all changes
@author Bryan Elliott <[email protected]>
###
###
Detect whether an Object is using this Mixin
###
Ember.Mixin::detectInstance = (object) ->
callMethod = (target, method, args) ->
method = target[method] if Ember.typeOf(method) is "string"
method.apply target, args
###
Returns a function, that, when invoked, will only be triggered at most once during a given window of time.
###
Ember.throttle = (target, method, wait) ->
timeout = undefined
@kumavis
kumavis / gist:5138519
Last active December 14, 2015 19:39
Time in javascript

“Why, sometimes I've believed as many as six impossible things before breakfast.”

-- Lewis Carroll, Alice in Wonderland

new Date() === new Date()
//=> false
new Date() == new Date()
//=> false
new Date() &gt; new Date()
Helpers.Velcro =
getSelection: ($elem) ->
$elem.find('.selectedOption').text().trim()
hasSelection: ($elem) ->
not Helpers.Velcro.getSelection($elem).contains("Select")
selectRandomOption: ($elem, continueTesting) ->
$elem.find('.velcro-dropdown').click()
var currentState = get(this, 'currentState') || this, state, newState;