Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.
brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
module.exports = { | |
twitter: { | |
consumer_key: '', | |
consumer_secret: '', | |
token: '', | |
token_secret: '' | |
}, | |
tracking: { | |
dev: ['gobelinou', 'taratta'], | |
prod: ['gobelinou'] |
const normalize = (min, max, value) => { | |
if (value < min) return min | |
else if (value > max) return max | |
else return value | |
} | |
const splitChannels = (color, split) => { | |
color = color.replace(split, '').replace(')', '').trim() | |
let channels = color.split(',') |
/** | |
* Generate web videos mp4 + webm from given folder | |
* You can pass options by file in videos.json | |
* Options are crop size | |
* NODE and FFMEPG is required. On mac brew install node && brew install ffmpeg | |
* FFMPEG command are inspired by https://gist.github.com/Vestride/278e13915894821e1d6f | |
* eg: node videos.js --input=../inputDir --output=../dir/outputDir --prefix=compressed --r-audio | |
* if missing outputDir, inputDir will be use | |
*/ |
echo "Creating an SSH key for you..." | |
ssh-keygen -t rsa | |
echo "Please add this public key to Github \n" | |
echo "https://github.com/account/ssh \n" | |
read -p "Press [Enter] key after this..." | |
echo "Installing xcode-stuff" | |
xcode-select --install |
class RAF { | |
constructor () { | |
if (!RAF.instance) { | |
this._radId = null | |
this._callbacksMap = {} | |
this._callbacks = [] | |
RAF.instance = this | |
} | |
return RAF.instance |
export const isAutoplaySupported = () => { | |
// Detect if user can autoplay inline video | |
// Works when user is on low-battery mode on IOS | |
// Return promise from video.play | |
const video = document.createElement('video') | |
video.src = 'data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAAAAG1wNDJtcDQxaXNvbWF2YzEAAATKbW9vdgAAAGxtdmhkAAAAANLEP5XSxD+VAAB1MAAAdU4AAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACFpb2RzAAAAABCAgIAQAE////9//w6AgIAEAAAAAQAABDV0cmFrAAAAXHRraGQAAAAH0sQ/ldLEP5UAAAABAAAAAAAAdU4AAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAoAAAAFoAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAHVOAAAH0gABAAAAAAOtbWRpYQAAACBtZGhkAAAAANLEP5XSxD+VAAB1MAAAdU5VxAAAAAAANmhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABMLVNNQVNIIFZpZGVvIEhhbmRsZXIAAAADT21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAw9zdGJsAAAAwXN0c2QAAAAAAAAAAQAAALFhdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAoABaABIAAAASAAAAAAAAAABCkFWQyBDb2RpbmcAAAAAAAAAAAAAAAA |
/** | |
* ScrollDirection | |
* Simple Singleton to listen scrollDirection | |
* Use an array of callbacks objects running when user scroll to top or to down | |
* Could be usefull to pin header on scroll top for example | |
*/ | |
class ScrollDirection { | |
constructor () { | |
if (!ScrollDirection.instance) { | |
this._isRunning = false |
/** | |
* ScrollRAF | |
* Optimize animations on scroll | |
* Simple Singleton to listen scroll and update things on raf | |
*/ | |
class ScrollRAF { | |
constructor () { | |
if (!ScrollRAF.instance) { | |
this._isRunning = false | |
this._callbacksMap = {} |
export default ({ target, listener = false }) => { | |
let observable = null | |
const set = (target, name, value) => { | |
target[name] = value | |
if (listener && typeof listener === 'function') { | |
listener(observable) | |
} | |
return true | |
} |