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
https://engineering.gosquared.com/optimising-nginx-node-js-and-networking-for-heavy-workloads | |
# sysctl | |
https://github.com/spheromak/sysctl-cookbook | |
/etc/sysctl.conf | |
net.ipv4.ip_local_port_range='1024 65000' | |
net.ipv4.tcp_tw_reuse='1' |
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
// https://medium.com/@PitaJ/javascript-inheritance-patterns-179d8f6c143c#.36nqv16pb | |
// Object.create, top-level factory, prototype post-declaration | |
function Animal(type){ | |
var animal = Object.create(Animal.prototype); | |
animal.type = type; | |
return animal; | |
} | |
Animal.isAnimal = function(obj, type){ | |
if(!Animal.prototype.isPrototypeOf(obj)){ |
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
// code incomplete, example only | |
Just.prototype.ap = function(m) { | |
return m.map(this.value); | |
}; | |
Nothing.prototype.ap = () => { return this } | |
function lift2(f, a1, a2){ |
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
// This code would be on any PHP page handling the login form | |
// Create a User suitable for logging in | |
$loggingInUser = new \Sparse\User(array('username'=>$_POST['username'],'password'=>$_POST['password'])); | |
// Make actual login API call | |
$loggingInUser->logIn(); | |
// This will be true if it worked | |
if($loggingInUser->authenticated()){ |