Instantly share code, notes, and snippets.

View listDependencies.js
const {compose, map, flatten, prop} = require('ramda');
const path_to_node_modules = './node_modules/';
const tabs = num => new Array(num).map(item => '\t ').join(' ');
export const getPackage = name => require(`${path_to_node_modules}${name}/package.json`);
const getDependencies = plugin => {
return [
plugin,
tree(getPackage(plugin))
];
View package_scripts.json
{
"scripts": {
"test": "mocha",
"serve": "http-server . -a 127.0.0.1 -p 4444",
"dev": "mkdir dist && npm run build && npm run watch",
"watch": "npm run watch::js & npm run watch::scss",
"build": "npm run build::js && npm run build::sass",
"dploy::staging": "dploy staging",
"dploy::prod": "dploy production",
"watch::js": "watchify src/*.js -o dist/app.js -dvt [ babelify --presets [ es2015 ] ]",
View middleware_system.js
// See more about my Cycle.js
// https://gist.github.com/ArthurMialon/aaed187b1b3bd567fde3
const Cycle = (array, i) => {
i = i || 0;
return {
next() {
i = (i + 1 == array.length) ? 0 : (i + 1);
return Cycle(array, i);
},
value: array[i]
View cycle.js
/**
* Cycle Array
* @param {array} a simple array
* @param {iterator} key [optional (Default: 0)]
*/
const Cycle = (array, i=0) => ({
get next() {
return Cycle(array, ((i + 1 == array.length) ? 0 : (i + 1)));
},
get previous() {