Skip to content

Instantly share code, notes, and snippets.

View trevor-atlas's full-sized avatar
👾
Variety is the spice of life, or something

Trevor Atlas trevor-atlas

👾
Variety is the spice of life, or something
View GitHub Profile
@trevor-atlas
trevor-atlas / es6-compose.md
Last active December 9, 2017 00:51 — forked from JamieMason/es6-compose.md
ES6 JavaScript compose function

ES6 JavaScript Compose Function

Definition

const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args)));
const pipe = (...fns) => compose.apply(compose, fns.reverse());

Example

@trevor-atlas
trevor-atlas / squirt.js
Last active October 2, 2017 18:55 — forked from joelpt/squirt.js
Manually calculate the square root of a number with Javascript
// The Babylonian Method
// http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
// @param n - the number to compute the square root of
// @param guess - the best guess so far (can omit from initial call)
function squirt(n, guess) {
if (!guess) {
guess = n / 2.0; // Take an initial guess at the square root
}
const divided = n / guess; // Divide our guess into the number
const newGuess = (divided + guess) / 2.0; // Use average of guess and divided as our new guess
const traceFn = (fn, context) => function () {
console.trace(`${fn.name} called with arguments: `, arguments);
return fn.apply(context || this, arguments);
}
console.log = traceFn(console.log);
console.log('foo');
//>> log called with arguments: ["foo"]
//>> (anonymous) @ VM98:2
//>> (anonymous) @ VM138:2
@trevor-atlas
trevor-atlas / .bashrc
Last active August 26, 2016 21:38 — forked from vsouza/.bashrc
Golang 1.5 setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@trevor-atlas
trevor-atlas / countries.php
Created June 3, 2016 22:06 — forked from JeffreyWay/countries.php
Country Names + Codes
[
"United States" => "us",
"Afghanistan" => "af",
"Albania" => "al",
"Algeria" => "dz",
"American Samoa" => "as",
"Andorra" => "ad",
"Angola" => "ad",
"Anguilla" => "ai",
"Antarctica" => "aq",
gulp.task('jekyll', function(){
return require('child_process').spawn('jekyll', ['serve', '--watch'], { stdio: 'inherit' });
});
gulp.task('default', ['jekyll']);
#!/bin/sh
# This is usually run by the d_install script (https://gist.github.com/treall/240b8408cd944c17551a)
# This script will:
# make sure you're in the correct directory,
# download the latest drupal 7 release,
# install our frequently used modules,
# setup the admin account,
# create an Aurora subtheme,
# update the .htaccess file for use on our outdated dev server,