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 add(a,b){ | |
if(arguments.length > 1){ | |
return a + b; | |
} else { | |
return function(b){ | |
return add(a, b); | |
}; | |
} | |
} | |
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
<div data-show-after-loaded="true"> | |
<h1 id="userNameBinding"></h1> | |
<form id="userInformationForm"> | |
<input name="userName" type="text"/> | |
<button type="submit">Update</button> | |
</form> | |
</div> | |
<div data-show-before-loaded="true"> | |
<i class="loading-icon"></i> | |
</div> |
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
var Bus = { | |
__nameSpaceMap: {}, | |
on: function(nameSpace, func){ | |
Bus.__nameSpaceMap[namespace] = Bus.__nameSpaceMap[namespace] || []; //new namespace if it doesn't exist | |
Bus.__nameSpaceMap[namespace].push(func); // add the func | |
return Bus; | |
}, | |
trigger: function(nameSpace, data){ | |
var triggeredAt = new Date(); //when they triggered the event / command | |
Bus.__nameSpaceMap[namespace].forEach(function(func){ |
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
//... | |
UserInformationCommandModel = { | |
el: "#userInformationForm", | |
$el: undefined, | |
getDataFromForm: function() { | |
return { | |
userName: UserInformationCommandModel.$el.find("input[name='userName']").val() | |
}; | |
}, |
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
green='\e[0;32m' | |
NC='\e[0m' | |
rm "signed.apk" | |
rm "android-release-unsigned.apk" | |
echo "" | |
echo -e "${green}Making production build${NC}" | |
echo "" | |
grunt dev:prod && cordova build android --release | |
echo "" |
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
Mixanator = { | |
mix: function() { | |
var func = window.compose.left.apply(null, arguments); | |
func.__composed = func; | |
func.extend = Mixanator.extend; | |
return func; | |
}, | |
extend: function() { | |
var args = argumentsToArray(arguments); | |
args = args.map(getComposedFuncs).filter(clear).concat(args); |
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
class Game { | |
constructor(ScoreBoard){ | |
this.ScoreBoard = ScoreBoard; | |
} | |
start() { | |
let limit = 3; | |
while(this.ScoreBoard.getHighestScore() !== limit && this.scoreCards.areAllQuestionsAsked()){ | |
this.ScoreBoard.askQuestion(); | |
this.ScoreBoard.sortByScore(); | |
} |
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
var Diviation = { | |
calc(arr = []){ | |
return Diviation.deviate(Diviation.variance(arr, Diviation.mean(arr))); | |
}, | |
mean(arr=[]){ | |
return arr.reduce((x,y) => x + y, 0) / arr.length; | |
}, | |
variance(arr = [], mean = 0) { | |
return arr.map(x => (Math.pow((x - mean), 2))) | |
.reduce((x,y) => x + y, 0) / arr.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
var Rovar = { | |
joiner: "o", | |
letters: "bcdfghjklmnpqrstvwxyz", | |
encode(str = "") { | |
if(str !== ""){ | |
let newString = str.split(""); | |
return newString.map(x => Rovar.letters.indexOf((x + "").toLowerCase()) > -1 ? x+Rovar.joiner+x.toLowerCase() : x ).join(""); | |
} | |
return ""; | |
}, |