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
public |
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
< style > | |
# elem - container { | |
position: absolute; | |
left: 100px; | |
top: 200px; | |
height: 100px; | |
} < /style> | |
<div id="elem-container">dummy</div > < div id = "output" > < /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
/** functional.js **/ | |
function flip (func) { | |
// preserve f | |
// construct g | |
return function() { | |
var args = Array.prototype.slice.call(arguments); | |
// flip arguments when called | |
return func.apply(null, args.reverse()); | |
}; |
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 memoizer (memo, formula) { | |
var recur = function(n) { | |
var result = memo[n]; | |
if (typeof result !== 'number') { | |
result = formula(recur, n); | |
memo[n] = result; | |
} | |
return result; | |
} |
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 { | |
overflow : hidden; | |
text-overflow : ellipsis; | |
white-space : nowrap; | |
width : 240px; | |
} |
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 isMale = false; | |
var age = 16; | |
if (isMale && age <= 14) { | |
console.log("Hi Boy!"); | |
} | |
else if (isMale && age > 14) { | |
console.log("Hi Man!"); | |
} | |
else if (!isMale && age <= 14) { |
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 countTotal = function(array, func) { | |
var total = 0; | |
array.forEach(function(each) { | |
total += func(each); | |
}); | |
return total; | |
} | |
var Movie = function(title, priceCode) { |
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 addf (x) { | |
return function(y) { | |
return x + y; | |
} | |
} | |
function add (x, y) { | |
return x + y; | |
} |
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
//Code snippet for https://www.youtube.com/watch?v=unEuPvA2wnM | |
//OOP style | |
ChatTabView = function(thread, rootDOM) { | |
this.el = Template.appendTo(rootDOM); | |
var participants = thread.getParticipants(); | |
this.el.find('.title') | |
.setText(generateTitle(participants.map('getName')); | |
}; |
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
_complete_ssh_hosts () | |
{ | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \ | |
cut -f 1 -d ' ' | \ | |
sed -e s/,.*//g | \ | |
grep -v ^# | \ | |
uniq | \ | |
grep -v "\[" ; |
OlderNewer