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
/** | |
* Runs multiple middlewares in parallel | |
* Usage: parallel(mw1, mw2, mw3); | |
*/ | |
const { after } = require("lodash"); | |
const parallel = (...fns) => (req, res, next) => { | |
const finalNext = after(fns.length, next); | |
fns.forEach(fn => fn(req, res, finalNext)); |
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
/* | |
Using genetic algorithim | |
Given an array of integers, say [-2, 9, 2, -5, 1, -3, -10, 6] | |
Find a sum of elements that is closest to 0 | |
This solution finds the best solution on 100 rounds. | |
The best solution is the Gene with it's defect closest to 0, | |
with the maximum number of elements included, | |
found on the earliest round possible | |
*/ |
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
/* | |
This code does the following: | |
1 - Start a new population of 50 "numbers" and a GOAL of 9999 | |
2 - Select the two highest multiple of 3 available | |
3 - Create a new generation of numbers ranging between it's parents values, incresing a little | |
4 - Do that until reaches the GOAL | |
*/ |
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
# Path to your oh-my-zsh installation. | |
export ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="arrow" | |
# Example aliases |
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
# Require any additional compass plugins here. | |
# Set this to the root of your project when deployed: | |
http_path = "../../" | |
css_dir = "../" | |
sass_dir = "." | |
images_dir = "../../img" | |
javascripts_dir = "../../js" | |
fonts_dir = "../../font" |
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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var myRobot; | |
var Robot = function(robot) { | |
robot.ahead(100); | |
robot.clone(); | |
myRobot = robot.id; | |
robot.log(myRobot); |
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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
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
var fs = require('fs'), | |
walk = function(dir, done) { | |
var results = []; | |
fs.readdir(dir, function(err, list) { | |
if(err) return done(err); | |
var pending = list.length; | |
if(!pending) return done(null, results); | |
list.forEach(function(file) { | |
file = dir + '/' + file; | |
fs.stat(file, function(err, stat) { |
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
### | |
jQuery.parallax | |
by ken210.com | |
Based on homonymous plugin by Ian Lunn | |
Author URL: http://www.ianlunn.co.uk/ | |
Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/ |