Skip to content

Instantly share code, notes, and snippets.

View vvo's full-sized avatar
🌱
Growing indie hacker

Vincent Voyer vvo

🌱
Growing indie hacker
View GitHub Profile
@vvo
vvo / offre d'emploi développeur JavaScript FTVEN.md
Last active December 16, 2015 20:09
Offre d'emploi développeur JavaScript chez France Télévisions Éditions Numériques

Offre d'emploi développeur JavaScript chez France Télévisions Éditions Numériques

France Télévisions Éditions Numériques recherche un développeur JavaScript confirmé ou au moins expérimenté avec une bonne soif d'apprendre.

Contexte

Vous rejoindrez l'équipe « player » qui s'occupe du développement du lecteur vidéo de tous les sites du groupe France Télévisions.

Vous pouvez voir un exemple de nos développements en production sur le site de culturebox.

@vvo
vvo / video-snapshots-sprites.sh
Created July 15, 2013 14:28
generate sprites of video snapshots
sudo aptitude install ffmpeg
sudo aptitude install imagemagick
# fps=1 > every seconds
ffmpeg -i video.mp4 -f image2 -vf fps=fps=1 out%d.png
# horizontal sprite, resized at 30%
convert -resize 30% +append out*.png sprite-1-sec.png
# references:
@vvo
vvo / pre-push
Created August 2, 2013 09:46
Git pre-push hook to launch `NODE_ENV=test grunt test` and check for return code
#!/usr/bin/env node
var spawn = require('child_process').spawn;
var cmd = 'grunt';
var args = ['test'];
var options = {
stdio: 'inherit'
};
process.env.NODE_ENV = 'test';
spawn(cmd, args, options).on('exit', check);
@vvo
vvo / api-namespace.txt
Last active December 26, 2015 03:58
api namespace
How would you implement a js solution to set up an api namespace:
api.ns.method();
api.ns2.method2();
api.ns2.method3();
api.prop = 'hello';
where
ns.method and ns2.method2 can access all `api` properties/ns using `this`:
@vvo
vvo / nginx
Created November 10, 2013 17:02
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g;
proxy_set_header Host $host;
proxy_cache STATIC;
proxy_cache_valid 200 1m;
proxy_cache_key "$scheme$host$request_uri";
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
server {
listen 80;
server_name myblog.com;
client_max_body_size 10M;
location ~* \.(jpg|jpeg|png|gif|ico|css|js|eot|woff)$ {
expires 10y;
proxy_pass http://localhost:2368;
}
server {
listen 80;
server_name myblog.com;
client_max_body_size 10M;
location / {
proxy_pass http://localhost:2368/;
proxy_buffering off;
}
# sets the proxy cache path location, max size 2g
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g;
# transfers the `Host` header to the backend
proxy_set_header Host $host;
# uses the defined STATIC cache zone
proxy_cache STATIC;
# cache 200 10 minutes, 404 1 minute, others status codes not cached
@vvo
vvo / simple webdriverjs example.js
Created December 15, 2013 23:08
simple webdriverjs example
['chrome', 'firefox'].forEach(detectBrowser);
function detectBrowser(name) {
require('webdriverjs')
.remote({
desiredCapabilities: {
browserName: name
}
})
.init()
@vvo
vvo / rethinkdb.js
Created May 27, 2014 06:45
rethinkdb native driver
var async = require('async');
var r = require('rethinkdb');
var debug = require('debug')('rethinkdb');
// first get some warming data to insert
var warmMessages = require('./generate-messages.js')(10000);
var host = process.env.HOST || 'localhost';
// get real data to insert