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
'00'.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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Tabs</title> | |
<style> | |
.nav .active a { color: red; } | |
.tab-pane { display: none; } | |
.tab-pane.active { display: block; } | |
</style> | |
</head> |
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 coinify(cents){ | |
var count = parseInt(cents / 50), | |
leftOver = cents % 50, | |
coins = [25, 10, 5, 1], | |
iterator = 0; | |
while (leftOver > 0){ | |
count += parseInt( leftOver / coins[iterator] ); | |
leftOver = leftOver % coins[iterator]; | |
iterator ++; |
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
importSchedule.startHourOptions = this._buildOptions(_.chain(_.range(0, 24)).map(function(hour){ | |
return {text: '00'.substring(0, '00'.length - hour.toString().length) + hour.toString(), value: hour}; | |
}).value(), importSchedule.start_hour); |
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
initialize: function(){ | |
_.bindAll(this, 'render', 'onImgLoad'); | |
this.mainImg = new Image(); | |
this.mainImg.src = this.model.get('img'); | |
this.userImg = new Image(); | |
this.userImg.src = this.model.get('admin').img; | |
this.mainImg.onload = this.onImgLoad; |
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 converter(st){ | |
var arrSt = st.split(''), | |
arrInt = []; | |
for (var i = 0; i < arrSt.length; i++){ | |
arrInt.push(arrSt[i].charCodeAt() - 48); | |
} | |
// loop over arry again |
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 data = eval('(' + XMLHttpRequest.responseText + ')'); |
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 foo = { | |
a: function () { | |
console.log(this); | |
} | |
}; | |
foo.a(); | |
// => foo | |
foo['a'](); |
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
const dog = () => { | |
const sound = 'woof' | |
return { | |
talk: () => console.log(sound) | |
} | |
} | |
const sniffles = dog() | |
sniffles.talk() // "woof" |
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
const barker = (state) => ({ | |
bark: () => console.log('Woof, I am ' + state.name) | |
}) | |
const driver = (state) => ({ | |
drive: () => state.position = state.position + state.speed | |
}) | |
barker({ name: 'karo'}).bark() | |
// Woof, I am karo |
OlderNewer