Skip to content

Instantly share code, notes, and snippets.

@bmorwood
bmorwood / clamp.js
Created March 14, 2014 01:28 — forked from kujon/clamp.js
/**
* Clamps a number. Based on Zevan's idea: http://actionsnippet.com/?p=475
* params: val, min, max
* Author: Jakub Korzeniowski
* Agency: Softhis
* http://www.softhis.com
*/
(function(){Math.clamp=function(a,b,c){return Math.max(b,Math.min(c,a));}})();
@bmorwood
bmorwood / gist:c11202cc081a54695f2a753efc3dfabb
Created April 26, 2016 01:12
Canadian province list; alphabetical, includes abbreviations, plain text and HTML versions
// Small version
var provinces = [
{plain:"Alberta",name:"Alberta",abbr:"AB"},
{plain:"British Columbia",name:"British Columbia",abbr:"BC"},
{plain:"Manitoba",name:"Manitoba",abbr:"MB"},
{plain:"New Brunswick",name:"New Brunswick",abbr:"NB"},
{plain:"Newfoundland & Labrador",name:"Newfoundland & Labrador",abbr:"NL"},
{plain:"Northwest Territories",name:"Northwest Territories",abbr:"NT"},
{plain:"Nova Scotia",name:"Nova Scotia",abbr:"NS"},
{plain:"Nunavut",name:"Nunavut",abbr:"NU"},
@bmorwood
bmorwood / hrm.js
Created February 1, 2020 18:35 — forked from dong-qian/hrm.js
HRM + create-react-app + redux
// index.js
ReactDOM.render(<App /> , document.getElementById('root'))
if (module.hot) {
module.hot.accept('./App', () => {
ReactDOM.render(<App />, document.getElementById('root'))
})
}
// store.js