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/sh | |
if [ $(ps aux | grep $USER | grep node | grep -v grep | wc -l | tr -s "\n") -eq 0 ] | |
then | |
export PATH=/usr/local/bin:$PATH | |
export NODE_ENV=production | |
cd /path/to/app && forever --spinSleepTime 10000 start server.js >> forever.log 2>&1 | |
fi |
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
.loop (0) {} | |
.loop (@index) when (@index > 0) { | |
.classname-@{index} { | |
top: @index * 1px; | |
} | |
.loop (@index - 1); | |
} | |
#example { | |
.loop(5); |
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
// render loop for more performant drawing updates | |
function renderLoop () { | |
tram.frame(renderLoop); | |
// do your render updates here. | |
} | |
// start render loop | |
tram.frame(renderLoop); |
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
// -------------------------------------------------- | |
// Drexel grids and view templates. | |
// -------------------------------------------------- | |
define(function (require) { | |
// dependencies | |
var _ = require('underscore'); | |
return { | |
// -------------------------------------------------- |
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
// remove audio + video + stop all the downloadin’ | |
// assumes $video and $audio are jQuery selectors for <video> and <audio> tags. | |
var removeMedia = function () { | |
_.each([$video, $audio], function ($media) { | |
if (!$media.length) return; | |
$media[0].pause(); | |
$media[0].src = ''; | |
$media.children('source').prop('src', ''); | |
$media.remove().length = 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 slots = iterator([80, 60, 50, 40, 20, 10], { shuffle: true, pool: 2 }); | |
var result = slots.next(); |
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
.gpu-cache-trick { | |
-webkit-backface-visibility: hidden; | |
-moz-backface-visibility: hidden; | |
-ms-backface-visibility: hidden; | |
-o-backface-visibility: hidden; | |
backface-visibility: hidden; | |
-webkit-transform: translate3d(0, 0, 0); | |
-moz-transform: translate3d(0, 0, 0); | |
-ms-transform: translate3d(0, 0, 0); | |
-o-transform: translate3d(0, 0, 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
// Depends on jQuery | |
// Assumes outerDiv and videoTag are jQuery objects | |
var width = outerDiv.width(); | |
var height = outerDiv.height(); | |
var aspectW = 16; | |
var aspectH = 9; | |
var scaleX = width / aspectW; | |
var scaleY = height / aspectH; | |
var scale = Math.max(scaleX, scaleY); |
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
.centered { | |
position: absolute; | |
top: 0; | |
right: 0; | |
bottom: 0; | |
left: 0; | |
margin: auto; | |
} |
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
// example window url: http://test.dev/stuff | |
var query = 'poop=butts&farts=smellz'; | |
var parser = document.createElement('a'); // create anonymous 'a' tag | |
parser.href = window.location.href; | |
parser.search = query; | |
console.log(parser.href); | |
// ^ should output: http://test.dev/stuff?poop=butts&farts=smellz |