This file contains 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
# A VLC invocation that converts a movie file into an audio file that iTunes will sync to your iPhone | |
/Applications/VLC.app/Contents/MacOS/vlc -I dummy --no-sout-video --sout-audio --no-sout-rtp-sap --no-sout-standard-sap --ttl=1 --sout-keep --sout "#transcode{acodec=s16l,channels=2}:std{access=file,mux=wav,dst=podcast.wav}" movie.mp4 |
This file contains 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
/** | |
* Allow other processes to execute while iterating over | |
* an array. Useful for large arrays, or long-running processing | |
* | |
* @param {Function} fn iterator fed each element of the array. | |
* @param {Function} next executed when done | |
*/ | |
Array.prototype.nonBlockingForEach = function(fn, next) { | |
var arr = this; | |
var i = 0; |
This file contains 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 Worker = require('webworker-threads').Worker; | |
var worker = new Worker('bin/testWorker.js'); | |
var workerSend; | |
(function() { | |
var idCounter = 0; | |
var callbacks = {}; | |
worker.onmessage = function(oEvent) { | |
var message = oEvent.data; |
This file contains 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
// sign up | |
account.signUp('[email protected]', 'secret'); | |
// sign in | |
account.signIn('[email protected]', 'secret'); | |
// sign in via oauth | |
account.signInWith('twitter'); | |
// sign out |
This file contains 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 | |
# SSH into a Vagrant VM, forwarding ports in a way that allows node within Vagrant to be debugged by a debugger | |
# or IDE in the host operating system. Don't know why, but Vagrantfile port forwarding does not work. | |
# (https://groups.google.com/forum/#!topic/vagrant-up/RzPooJ0dp6Q) | |
/usr/bin/vagrant ssh-config > $TMPDIR/vagrant-ssh-config | |
ssh -F $TMPDIR/vagrant-ssh-config -L 5858:127.0.0.1:5858 default | |
rm $TMPDIR/vagrant-ssh-config |
This file contains 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
'use strict'; | |
var when = require('when'), | |
delay = require('when/delay'), | |
unfold = require('when/unfold'); | |
function getNumber() { | |
var deferred = when.defer(); | |
deferred.resolve(Math.floor(Math.random() * 10)); | |
return deferred.promise; |
This file contains 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
'use strict'; | |
var Q = require('q'); | |
// `condition` is a function that returns a boolean | |
// `body` is a function that returns a promise | |
// returns a promise for the completion of the loop | |
function promiseWhile(condition, body) { | |
var done = Q.defer(); |
This file contains 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
* { | |
-webkit-filter: grayscale(100%) !important; | |
background-color: white !important; | |
border-color: black !important; | |
color: black !important; | |
font-family: "redacted script" !important; | |
} |
This file contains 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
/** | |
* postgres does not have replace into, so... | |
* | |
* @param {Object} tile specification {tx: ty: zoom:} | |
* @param {Object} quad properties of that tile | |
* @param {Knex.transaction} t database transaction | |
* @return {Promise} | |
*/ | |
function insertOrUpdateTile(tile, quad, t) { |
This file contains 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
// promisey foreach loop | |
'use strict'; | |
var Promise = require('bluebird'), | |
promiseWhile = require('./promiseWhile'); | |
/** | |
* Promisey foreach | |
* |
OlderNewer