Skip to content

Instantly share code, notes, and snippets.

@tphdev
tphdev / warmup-math-prototype-range.js
Created October 20, 2016 12:30
Create sth on the prototype - Math.prototype.range
//-----------------------------------------
// Math.protoytype.range()
// Write a method called `range` to the Math prototype that accepts 2 arguments and
// returns a random integer number inside of that range
//
// The order of the arguments passed shouldn't matter.
//
// Hint: You will need to use the existing Math.prorotMath.prototype.floor()
//------------------------------------------
@tphdev
tphdev / get-fa-fonts.sh
Last active October 16, 2016 17:06
get-fa-fonts.sh
mkdir ./css/fonts
FONTS_ARRAY=(eot svg ttf woff woff2)
for font_ext in "${FONTS_ARRAY[@]}"
do
echo downloading $font_ext
curl https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/fonts/fontawesome-webfont.${font_ext}?raw=true > ./css/fonts/fontawesome-webfont.${font_ext}
done
@tphdev
tphdev / get-fonts.sh
Created October 16, 2016 17:05
get-fonts.sh
mkdir ./css/fonts
FONTS_ARRAY=(eot svg ttf woff woff2)
for font_ext in "${FONTS_ARRAY[@]}"
do
echo downloading $font_ext
curl https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/fonts/fontawesome-webfont.${font_ext}?raw=true > ./css/fonts/fontawesome-webfont.${font_ext}
done
@tphdev
tphdev / promiser.js
Last active October 14, 2016 10:57
simple promise implementation
console.log('wired up!')
var Promiser = {
callBackList: [],
fetchJSON: function(url){
var resolvePromise = function (context) {
var dataResponse = JSON.parse(this.responseText)
var cb = context.callBackList.shift()
@tphdev
tphdev / NavBar.js
Last active May 10, 2016 20:45
nav bar in react using single responsibility principle
var MyNav = React.createClass({
_testForCompleteFields: function(uMod){
var criticalFields = ['yard', 'dev', 'whatev']
var fieldsAreComplete = true
criticalFields.forEach(function(field){
if ( uMod.get(field) === null ) { fieldsAreComplete = false }
})
return fieldsAreComplete
puts "hello gist"