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
/* Random Number */ | |
var randomNumber = Math.floor(Math.random() * 2); | |
console.log(randomNumber); |
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
/* Random Boolean */ | |
var randomNumber = Math.random() >= 0.5; | |
console.log(randomNumber); |
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
# run command and log out and log in | |
sudo rm -ri ~/.Trash |
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
sudo defaults write /System/Library/LaunchAgents/com.apple.notificationcenterui KeepAlive -bool false | |
# You can re-enable notification center by replacing “false” in the above statement with “true.” | |
killall NotificationCenter |
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
# Source: http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo | |
# This looks like a permissions issue in your home directory. To reclaim ownership of the .npm directory execute | |
sudo chown -R `whoami` ~/.npm | |
# Also you will need the write permission in node_modules directory: | |
sudo chown -R `whoami` /usr/local/lib/node_modules |
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
# NPM | |
npm update | |
# Ruby gems | |
gem update | |
# Homebrew | |
brew upgrade | |
# yeoman generators |
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
// Smooth scrolling | |
// Source: http://www.paulund.co.uk/smooth-scroll-to-internal-links-with-jquery | |
$('a[href^="#"]').on('click',function (e) { | |
e.preventDefault(); | |
var target = this.hash, | |
$target = $(target); | |
$('html, body').stop().animate({ |
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
/*global $:false */ | |
'use strict'; |
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
var twoPlacedFloat = parseFloat(yourString).toFixed(2) |
OlderNewer