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
.row { | |
-webkit-user-select: none; /* Chrome all / Safari all */ | |
-moz-user-select: none; /* Firefox all */ | |
-ms-user-select: none; /* IE 10+ */ | |
user-select: none; /* Likely future */ | |
} |
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
//parse and populate list | |
function handleFileSelect(e) { | |
var file = e.target.files[0]; | |
Papa.parse(file, { | |
header: true, | |
dynamictyping: true, | |
complete: function (results) { | |
parsed = results; //remove on prod |
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
$('.list-group-item').hover(function () { | |
$(this).addClass('list-group-item-info'); | |
}, function () { | |
$(this).removeClass('list-group-item-info'); | |
}); |
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
<span class="btn btn-default btn-file"> | |
Browse <input type="file"> | |
</span> | |
<style> | |
.btn-file { | |
position: relative; | |
overflow: hidden; | |
} | |
.btn-file input[type=file] { |
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
//getters and settings done easy | |
var Circle = function(radius) { | |
this._radius = radius; | |
}; | |
Circle.prototype = { | |
set radius(radius) {this._radius = radius;}, | |
get radius() { return this._radius;}, | |
get area() { return Math.PI * (this._radius * this._radius);} | |
}; |
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
import {expect} from 'chai'; | |
describe('immutability', () => { | |
describe('a number', () => { | |
function increment(currentState) { | |
return currentState + 1; | |
} |
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
//stop imperatively iterating! | |
var fictionalCharacters = [ | |
{ name: 'Beavis', universe: 'Beavis and Butthead'}, | |
{ name: 'Cartman', universe: 'Southpark'}, | |
{ name: 'Stimpy', universe: 'Ren and Stimpy'}, | |
{ name: 'Butthead', universe: 'Beavis and Butthead'}, | |
{ name: 'Stan', universe: 'Southpark'}, | |
{ name: 'Ren', universe: 'Ren and Stimpy'}, | |
{ name: 'Ironman', universe: 'Marvel'} |
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
//the with statement is bad | |
with(o){ | |
foo = bar; | |
} | |
//impossible to tell (in this context) what this statement will expand into | |
//1. o.foo = bar; | |
//2. o.foo = o.bar; | |
//3. foo = bar; |
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
//class free oop | |
function constructor(spec) { | |
let {member} = spec, | |
{other} = other_constructor(spec), | |
method = function() { | |
// member, other, method, spec | |
}; | |
return Object.freeze({ | |
method, |
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
//es5 | |
function repeat(func) { | |
while (func() !== undefined) { | |
} | |
} | |
//es6 proper tail call | |
function repeat(func) { | |
if (func() !== undefined) { | |
return repeat(func); |