This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let normalB = require('b'); | |
let A = { | |
init(url, B = normalB){ | |
return B.fetch(url); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* # 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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| |