Skip to content

Instantly share code, notes, and snippets.

View kumavis's full-sized avatar
🐉
!

kumavis kumavis

🐉
!
View GitHub Profile
var currentState = get(this, 'currentState') || this, state, newState;
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()
@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() > new Date()
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 / 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) ->
@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 / gist:5603550
Created May 18, 2013 07:13
「ご存知の通り」の別の言い方
御承知置きの通り
お聞き入れの通り
お聞き届けの通り
御領承の通り
御応諾の通り
御承引の通り
@kumavis
kumavis / error_forwarding.coffee
Last active December 17, 2015 15:29
Ember error phone home
# ===
# = This helper sends client errors home to the server for logging
# ===
# TODO: include some client diagnostics, browser type etc
# Grab standard error callback
_super = Ember.Logger.error
# Overwrite error callback to phone home
Ember.Logger.error = (message) ->
@kumavis
kumavis / gist:5676173
Created May 30, 2013 07:05
npm ERR! peerinvalid The package voxel-engine does not satisfy its siblings' peerDependencies requirements!

fresh clone of voxel-gist [https://github.com/maxogden/voxel-gist]

[kumavis:...Development/Node/voxel-gist]$ npm install

npm http GET https://registry.npmjs.org/ecstatic/0.3.2
npm http GET https://registry.npmjs.org/jsonp/0.0.3
npm http GET https://registry.npmjs.org/javascript-editor/0.0.1
npm http GET https://registry.npmjs.org/snuggie/0.0.4
npm http GET https://registry.npmjs.org/uglify-js/2.2.3
@kumavis
kumavis / gist:5681595
Last active December 17, 2015 22:19
Quick and dirty grab of the node fs attributes used by node-browserify and dependencies. Generated by cloning the repo, npm install, project-wide search for "fs.", grabbing all the words following the period, forming them into a list of strings and dropping them into an irb sesh, calling uniq, sorting, then joining with a newline. Finally, manua…

filesystem-browserify implements: 7 attributes

createReadStream
createWriteStream
readFile
readdir
rename
unlink
writeFile