Skip to content

Instantly share code, notes, and snippets.

View saip106's full-sized avatar

Sai Gudigundla saip106

  • Leancode Inc
  • Pittsburgh, PA
View GitHub Profile
@ThomasBurleson
ThomasBurleson / verboseForLoop.js
Last active August 29, 2015 13:57
Demonstration of reducing a messy, verbose `for loop` using functional approach for terse, concise solution.
/**
* Traditional solution: For-loop usage
*/
function buildEpisodes(markers)
{
var result = [],i, newEpisode;
if (markers && markers.length > 0) {
for (i = 0; i < markers.length; i++) {
newEpisode = makeEpisode(markers[i]);
@hofmannsven
hofmannsven / README.md
Last active August 30, 2024 10:34
Git CLI Cheatsheet
@Gozala
Gozala / example.js
Created January 29, 2012 03:46
Workaround for lack of "tail call optimization" in JS
// Lack of tail call optimization in JS
var sum = function(x, y) {
return y > 0 ? sum(x + 1, y - 1) :
y < 0 ? sum(x - 1, y + 1) :
x
}
sum(20, 100000) // => RangeError: Maximum call stack size exceeded
// Using workaround