Skip to content

Instantly share code, notes, and snippets.

View edwinvdgraaf's full-sized avatar

Edwin van der Graaf edwinvdgraaf

View GitHub Profile
let normalB = require('b');
let A = {
init(url, B = normalB){
return B.fetch(url);
}
};
@edwinvdgraaf
edwinvdgraaf / mayFire.js
Created September 12, 2014 11:39
mayFire.js
/* # Testing oberserved properties in Ember.js
It can happen that observers are still firing after testing your property, this snippets
lets you define an regex to catch errors, and make it look slightly nicer.
*/
import Ember from 'ember';
export default function mayFire(regEx, callback, scope){
var result;
scope = scope || this;
#!/bin/bash
# Downsamples all retina [email protected] images.
for f in $(find . -name '*@2x.png'); do
echo "Converting $f..."
convert "$f" -resize '50%' "$(dirname $f)/$(basename -s '@2x.png' $f).png"
done
var throttle = function(fn, delay) {
delay || (delay = 100);
var throttle = false;
return function(){
if (throttle){ return; } // you no enter
throttle = setTimeout(function(){
// tail it - and do one last ajax request
fn.apply(this, arguments);
throttle = false;
}, delay);
playlist = session.container.contents[1]
if !playlist.loaded?
playlist.load
end
chached_playlist = playlist.to_link # not optimal but works?
playlist.on(:tracks_added) do |tracks, position|