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
// Compares first value to the second one allowing entering IF clouse if true. | |
// Otherwise entering ELSE clause if exist. | |
Handlebars.registerHelper('ifEquals', function(a, b, options) { | |
if (a === b) { | |
return options.fn(this); | |
} | |
return options.inverse(this); | |
}); |
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
/** | |
* Returns localStorage (or its particular key) allocated memory | |
* in Megabytes (MB). | |
* @param {string=} opt_key inside the storage to calculate | |
* used space for. | |
* @return {number} with 2 decimal points. | |
*/ | |
function getLocalStorageUsedSpace(opt_key) { | |
var allocatedMemory = 0, | |
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
/** | |
* Turns a number/string to 2 digits day of the month with leading zero. | |
* @param {number|string} day to turn into day. | |
* @return {string} | |
*/ | |
function numberToDay(j) { | |
return ('0' + j).slice(-2); | |
} | |
// Examples: |
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
# By executing this command in your Mac OSX Terminal, all git commands will have | |
# colors, so you're more comfortable reading git produced output. | |
git config --global color.ui true |
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
#!/bin/bash | |
# | |
# This script will make a webcam snapshot every commit. The jpg file will have | |
# the commit id as the filename. | |
# | |
# This script requires imagesnap. Install with: 'brew install imagesnap' | |
# | |
# Put this file in the '.git/hooks/' name it 'post-commit' and chmod it by: | |
# 'chmod +x .git/hooks/post-commit' | |
# |
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
#!/bin/bash | |
# Sometimes you need to move your existing git repository | |
# to a new remote repository (/new remote origin). | |
# Here are a simple and quick steps that does exactly this. | |
# | |
# Let's assume we call "old repo" the repository you wish | |
# to move, and "new repo" the one you wish to move to. | |
# | |
### Step 1. Make sure you have a local copy of all "old repo" | |
### branches and tags. |
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
--strict | |
--jsdoc | |
--summary | |
--beep | |
--check_html | |
--nomultiprocess | |
--debug_indentation | |
--time |
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
/** | |
* @fileoverview Utils Interface credit card validation methods. | |
* @author (Wind Tammer) | |
*/ | |
utils = {}; | |
/** @type {Object<Function>} */ | |
utils.creditcard = {}; | |
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
'use strict'; | |
var Promise = require('promise'); | |
/** @desc A function that returns a promise with an error-prone code. */ | |
function build() { | |
return new Promise(function(fulfill, reject) { | |
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
'use strict'; | |
var Promise = require('promise'); | |
function build() { | |
return new Promise(function(fulfill, reject) { | |
fulfill('zero'); | |
}); |