View gist:4707701
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
<!doctype html> | |
<html class="no-js" lang="fr"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="icon" type="image/png" href="http://alexgalinier.com/static/images/alexgalinier-site-favicon_32x32.png" /> <!-- 32x32 image--> | |
<!-- Safari standalone web app config --> |
View gist:5003922
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-keyframes {name} { | |
0% { {from} } | |
100% { {to} } | |
} | |
@-moz-keyframes {name} { | |
0% { {from} } | |
100% { {to} } | |
} | |
@-o-keyframes {name} { | |
0% { {from} } |
View sm-annotated.html
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
<script type="text/javascript"> | |
(function () { | |
"use strict"; | |
// once cached, the css file is stored on the client forever unless | |
// the URL below is changed. Any change will invalidate the cache | |
var css_href = './index_files/web-fonts.css'; | |
// a simple event handler wrapper | |
function on(el, ev, callback) { | |
if (el.addEventListener) { | |
el.addEventListener(ev, callback, false); |
View JS: Async load js file
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 s = document.createElement('script'); | |
s.type = 'text/javascript'; | |
s.async = true; | |
s.src = 'http://yourdomain.com/script.js'; | |
var x = document.getElementsByTagName('script')[0]; | |
x.parentNode.insertBefore(s, x); |
View filterAndGroup.js
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
function filterAndGroup(data, filterFunc, groupByKey) { | |
return data.reduce((acc, item) => { | |
if (filterFunc(item)) { | |
if (item[groupByKey] in acc) { | |
acc[item[groupByKey]].push(item); | |
} else { | |
acc[item[groupByKey]] = [item]; | |
} | |
} |
View package.json
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
{ | |
"name": "...", | |
"version": "1.0.0", | |
"description": "...", | |
"main": "index.js", | |
"scripts": { | |
"build": "...", | |
"test": "...", | |
"deploy": "..." | |
}, |
View pick.js
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
const typeOf = _ => Object.prototype.toString.call(_); | |
// Result can be used with db.collection.find : PARTIALLY | |
const arrayToSchema = keys => | |
keys.reduce((schema, _) => { | |
if (_.indexOf('.') > -1) { | |
const [key, rest] = _.split('.'); | |
schema[key] = { | |
...schema[key], | |
...arrayToSchema([rest]), |
View spawnP.js
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
const { spawn } = require('child_process'); | |
const spawnP = async command => { | |
return new Promise((res, rej) => { | |
const cmdParts = command.split(' '); | |
const cmdSpawm = spawn( | |
cmdParts[0], | |
cmdParts.length > 1 ? cmdParts.slice(1) : [], | |
{ | |
stdio: 'inherit' |