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 characters
| function repeat(str, num) { | |
| var result; | |
| num > 0 ? result = str.repeat(num) : result = ''; | |
| return result; | |
| } | |
| repeat("abc", 3, ""); |
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 characters
| function repeat(str, num) { | |
| if(num === 0) { return str; } | |
| else if(num > 0) { | |
| var newStr = ''; | |
| var i = 0; | |
| while(num > i){ newStr += str; i++; } | |
| return newStr; | |
| } else { return ''; } | |
| } | |
| repeat("abc", 3, ""); |
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 characters
| function truncate(str, num) { | |
| if(str.length > num) str = str.slice(0, num - 3) + '...'; | |
| return str; | |
| } | |
| truncate('A-tisket a-tasket A green and yellow basket', 11); |
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 characters
| function chunk(arr, size) { | |
| var temp = [], i = 0; | |
| while (i < arr.length) { | |
| temp.push(arr.slice(i, i += size)); | |
| } | |
| return temp; | |
| } |
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 characters
| function chunk(arr, size) { | |
| var temp = [], result = []; | |
| for (var a = 0; a < arr.length; a++) { | |
| if (a % size !== size - 1) temp.push(arr[a]); | |
| else { temp.push(arr[a]); result.push(temp); temp = []; } | |
| } | |
| if (temp.length !== 0) result.push(temp); | |
| return result; | |
| } |
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 characters
| function factorialize(num) { | |
| var deger = 1; | |
| for(num; num > 1; num--) deger *= num; | |
| return deger; | |
| } | |
| factorialize(5, ''); |
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 characters
| import processing.video.*; | |
| import com.google.zxing.*; | |
| import java.awt.image.BufferedImage; | |
| Capture cam; //Set up the camera | |
| com.google.zxing.Reader reader = new com.google.zxing.qrcode.QRCodeReader(); | |
| int WIDTH = 640; | |
| int HEIGHT = 480; |
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 characters
| jQuery(document).ready(function() { | |
| jQuery(':input').blur(function () { | |
| var formName = {{FORM NAME}}; // Change {{FORM NAME}} | |
| if(jQuery(this).val().length > 0) { | |
| _gaq.push(['_trackEvent', formName, 'Completed', jQuery(this).attr('name')]); | |
| } | |
| else { | |
| _gaq.push(['_trackEvent', formName, 'Canceled', jQuery(this).attr('name')]); | |
| } | |
| }); |
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 characters
| jQuery('a').click(function() { | |
| getURL = jQuery(this).attr('href'); | |
| getURLParts = /^(?:\w+\:\/\/)?([^\/]+)(.*)$/.exec(getURL); | |
| getHostname = getURLParts[1]; | |
| getPath = getURLParts[2]; | |
| alert(getPath); | |
| return false; | |
| }); |