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
uniqueId = (length=8) -> | |
id = "" | |
id += Math.random().toString(36).substr(2) while id.length < length | |
id.substr 0, length | |
uniqueId() # => n5yjla3b | |
uniqueId(2) # => 0d | |
uniqueId(20) # => ox9eo7rt3ej0pb9kqlke | |
uniqueId(40) # => xu2vo4xjn4g0t3xr74zmndshrqlivn291d584alj |
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
window.requestAnimFrame = (function(){ | |
return window.requestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.mozRequestAnimationFrame || | |
window.oRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
function( callback ){ | |
window.setTimeout(callback, 1000 / 60); | |
}; | |
})(); |
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
/** | |
* Taken from: http://codepen.io/hakimel/pen/hGwmg | |
* | |
* Animates the given set of properties on the specified | |
* element. Properties should include units where possible, | |
* px will not be added automatically. For example: | |
* | |
* animate( document.querySelector( 'body' ), { | |
* width: '200px' | |
* }, { |
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
/* | |
* requestAnimationFrame polyfill | |
*/ | |
(function() { | |
var | |
lastTime = 0, | |
vendors = ['ms', 'moz', 'webkit', 'o'] | |
for ( var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x ) { |
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
// Register the pluralize helper. | |
Ember.Handlebars.registerBoundHelper( 'pluralize', function( number, options ) { | |
var phraseMatch = ( options.hash.phrase || '{|s}' ).match( /(.*?)\{(.*?)\|(.*?)\}/ ) | |
Ember.assert( 'The optional "phrase" hash for {{pluralize}} should be formatted as <phrase to pluralize>{<singular ending>|<plural ending>}', phraseMatch ) | |
var word = phraseMatch[ 1 ], | |
singular = word + phraseMatch[ 2 ], | |
plural = word + phraseMatch[ 3 ] | |
return number == 1 ? singular : plural | |
}) |
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
.picker__holder, | |
.picker--opened .picker__holder { | |
max-height: 25em; | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; | |
filter: alpha(opacity=100); | |
-moz-opacity: 1; | |
opacity: 1; | |
border-top-width: 1px; | |
border-bottom-width: 1px; | |
-webkit-transform: translateY(0) perspective(600px) rotateX(0); |
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
// @flow | |
import * as _ from 'lodash' | |
/////////////////// | |
// FILTER & SORT // | |
/////////////////// | |
type FilterAndSortType = ({ | |
data: Array<*>, |
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
git tag --delete TAG_NAME | |
git push origin :refs/tags/TAG_NAME |
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
# Simple | |
ffmpeg -i MY_FILE.mov -c copy NEW_FILE.mp4 | |
# Compressed | |
ffmpeg -i MY_FILE.mov -c copy -crf 20 NEW_FILE.mp4 | |
# Compressed (alternative) | |
ffmpeg -i MY_FILE.mp4 -acodec mp2 NEW_FILE.mp4 | |
# Compressed (alternative with audio) |
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
// Modified from https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder#Polyfill | |
function stringToBuffer(str) { | |
'use strict' | |
let Len = str.length, | |
resPos = -1 | |
// The Uint8Array's length must be at least 3x the length of the string because an invalid UTF-16 | |
// takes up the equivalent space of 3 UTF-8 characters to encode it properly. | |
let resArr = new Uint8Array(Len * 3) | |
for (let point = 0, nextcode = 0, i = 0; i !== Len; ) { |
OlderNewer