-
-
Save x1unix/1b3ed5e2754ccf744c78 to your computer and use it in GitHub Desktop.
Revisions
-
berzniz revised this gist
Dec 6, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ ['first', 'name'].join(' '); // = 'first name'; ['milk', 'coffee', 'sugar'].join(', '); // = 'milk, coffee, sugar' -
berzniz revised this gist
Nov 24, 2013 . 5 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes.File renamed without changes.File renamed without changes.File renamed without changes. -
berzniz revised this gist
Nov 24, 2013 . 7 changed files with 60 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ ['first', 'name'].join(' '); // = 'first name'; ['milk', 'coffee', 'suger'].join(', '); // = 'milk, coffee, suger' This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,10 @@ // default to 'No name' when myName is empty (or null, or undefined) var name = myName || 'No name'; // make sure we have an options object var doStuff = function(options) { options = options || {}; // ... }; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ var deeplyNestedFunction = function() { var private_object = { year: '2013' }; // Globalize it for debugging: pub = private_object; }; // Now from the console (Chrome dev tools, firefox tools, etc) pub.year; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ // Boring if (success) { obj.start(); } else { obj.stop(); } // Hipster-fun var method = (success ? 'start' : 'stop'); obj[method](); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ var firstName = 'Tal'; var screenName = 'ketacode' // Ugly 'Hi, my name is ' + firstName + ' and my twitter screen name is @' + screenName; // Super var template = 'Hi, my name is {first-name} and my twitter screen name is @{screen-name}'; var txt = template.replace('{first-name}', firstName) .replace('{screen-name}', screenName); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ var a = [1,2,3,4,5,6,7,8,9,10]; console.time('testing_forward'); for (var i = 0; i < a.length; i++); console.timeEnd('testing_forward'); // output: testing_forward: 0.041ms console.time('testing_backwards'); for (var i = a.length - 1; i >= 0; i--); console.timeEnd('testing_backwards'); // output: testing_backwards: 0.030ms This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ var z = 15; doSomeMath(z, 10); xxx // Great placeholder. I'm the only one using xxx and it's so easy to find in code instead of TODOs doSomeMoreMath(z, 15); -
berzniz created this gist
Nov 24, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ // Boring if (isThisAwesome) { alert('yes'); // it's not } // Awesome isThisAwesome && alert('yes'); // Also cool for guarding your code var aCoolFunction = undefined; aCoolFunction && aCoolFunction(); // won't run nor crash This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ var x = 1; debugger; // Code execution stops here, happy debugging x++; var x = Math.random(2); if (x > 0.5) { debugger; // Conditional breakpoint } x--; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ var a = meaningOfLife || 42;