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
import React from 'react'; | |
export default function useUpdateEffect(callback, properties, cleanup) { | |
let initialized = React.useRef(false); | |
React.useEffect(() => { | |
if (initialized.current) { | |
callback(properties); | |
} else { | |
initialized.current = true; |
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
{"lastUpload":"2020-05-06T14:05:50.026Z","extensionVersion":"v3.4.3"} |
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
/* | |
Calculate Wilks Coefficient to compare Powerlifting totals across bodyweights | |
https://en.wikipedia.org/wiki/Wilks_Coefficient | |
wilks(#body_weight, female?); | |
*/ | |
const men = [ | |
-216.0475144, | |
16.2606339, |
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
// solves http://adventofcode.com/day/1/ | |
const floors = (input) => (input.match(/\(/g) || []).length - (input.match(/\)/g) || []).length; |
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
@import "compass/utilities/general/clearfix"; | |
@import "compass/css3/box"; | |
@import "compass/css3/box-sizing"; | |
$num-cols: 12; | |
.container { | |
@include pie-clearfix; | |
margin-right: auto; | |
margin-left: auto; |
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
/** | |
* _.getTemplate( selector ) returns a precompiled ( and cached ) template function based on selector html; assumes jQuery and Underscore | |
* @param { Selector } selector path to element ( most commonly a script tag with type= eg "x-underscore-template" ) containing template src | |
* @return {[type]} precompiled template function; pass in data object, returns rendered template text for .html() or .innerHTML = | |
*/ | |
( function( global, _, undefined ) { | |
var templates = {}; | |
_.getTemplate = function( selector ) { |
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
// each( collection { obj || array }, callback, [ context ] ) | |
// iterates over a collection, runs callback with either collection or optional context as value of 'this' | |
// | |
// callback sent the following arguments: | |
// * current item value | |
// * index or key | |
// * collection | |
( function( global ) { |
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
// Can substitute "this" ( / "global" ) for whatever object you want to extend, eg "library.util" or whatever | |
// | |
// Creates: | |
// | |
// isBoolean( obj ) | |
// isNumber( obj ) | |
// isString( obj ) | |
// isFunction( obj ) | |
// isArray( obj ) | |
// isDate( 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
( function( $ ) { | |
function Template( src ) { | |
if ( src && typeof src === 'string' ) { | |
this.src = src; | |
} | |
} | |
$.extend( Template.prototype, { | |
render : function( data ) { | |
return this.src.replace(/\$\{\s?([a-zA-Z_$][0-9a-zA-Z_$]*?)\s?\}/g, function(match, key) { | |
return data && data[key] ? data[key] : ''; |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl http://npmjs.org/install.sh | sh |
NewerOlder