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 BinaryHeap(scoreFunction){ | |
this.content = []; | |
this.scoreFunction = scoreFunction; | |
} | |
BinaryHeap.prototype = { | |
push: function(element) { | |
this.content.push(element); | |
this.bubbleUp(this.content.length - 1); |
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(){ | |
this.Terminal = function(container, steps){ | |
this.container = document.getElementById(container); | |
this.steps = steps; | |
this.cycle = this.cycle.bind(this); | |
this.cycle(); | |
}; | |
this.Terminal.prototype.cycle = function(){ |
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
for (var key = 0, value; value = someArray[key++];) { | |
// value is already defined by for loop | |
console.log('index: ' + key, 'value: ' + value); | |
} |
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 num = 1; | |
var num2 = num; | |
num++; | |
console.log(num); // 2 | |
console.log(num2); // 1 | |
var obj = { | |
val: 'A string' | |
}; |
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(){ | |
var obj = { | |
name: 'No Name' | |
}; | |
window.setName = function(name){ | |
obj.name = name; | |
}; |
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
{ | |
guiEnabled: true, | |
draw: function(){ | |
this.parent(); | |
if (this.guiEnabled) { | |
this.drawGUI(); | |
} | |
}, |
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 Settings = Class.$extend({ | |
chart: { | |
type: 'spline' | |
}, | |
title: { | |
text: null | |
}, | |
xAxis: { | |
title: { | |
text: "Time (sec)", |
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 template = [ | |
'<div>', | |
'<h1>{title}</h1>', | |
'<p>{content}</p>', | |
'</div>' | |
].join(''); |
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
" TESTING: Toggle whitespace save | |
function! ToggleWhitespaceSave() | |
if exists('b:pw') && b:pw == 1 | |
unlet b:pw | |
echo 'Stripping whitespace on save' | |
else | |
let b:pw = 1 | |
echo 'Preserving whitespace on save' | |
endif | |
endfunction |
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! SynStack() | |
echo join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), " > ") | |
endfunc | |
nnoremap <F7> :call SynStack()<CR> |