This file contains 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
# Show branch name in bash prompt | |
``` | |
nano ~/.bash_profile | |
``` | |
Then copy/paste following code: | |
``` | |
parse_git_branch() { |
This file contains 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
const script = document.createElement("script"); | |
script.type = "text/javascript"; | |
script.src = "https://getfirebug.com/firebug-lite-debug.js"; | |
document.head.appendChild(script); |
This file contains 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
[3710, 3770, 5060, 3990, 5380, 4090, 5380, 6000, 3750, 3800, 7050, 5280, 4570] |
This file contains 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 foo = { bar: 'baz' }; | |
console.watch = function(obj, prop) { | |
var _prop = "$_" + prop + "_$"; | |
obj[_prop] = obj[prop]; | |
Object.defineProperty(obj, prop, { | |
get: function () { | |
return obj[_prop]; |
This file contains 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 serialize = function(obj, prefix) { | |
// http://stackoverflow.com/questions/1714786/querystring-encoding-of-a-javascript-object | |
var str = []; | |
for(var p in obj) { | |
var k = prefix ? prefix + "[" + p + "]" : p, v = obj[p]; | |
str.push(typeof v == "object" ? serialize(v, k) : encodeURIComponent(k) + "=" + encodeURIComponent(v)); | |
} | |
return str.join("&"); | |
} |
This file contains 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
if ('ontouchstart' in window) { | |
var TouchDragAndDrop = function(event) { | |
var touch = event.changedTouches[0], | |
fakedEvent = document.createEvent("MouseEvent"); | |
fakedEvent.initMouseEvent({ touchstart: "mousedown", touchmove: "mousemove", touchend: "mouseup" }[event.type], true, true, window, 1, touch.screenX, touch.screenY, touch.clientX+40, touch.clientY, false, false, false, false, 0, null); | |
touch.target.dispatchEvent(fakedEvent); | |
return false; | |
} | |
document.addEventListener("touchstart", TouchDragAndDrop, true); | |
document.addEventListener("touchmove", TouchDragAndDrop, true); |
This file contains 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
// Javascript Design Pattern |
This file contains 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 _notification = { | |
checkSupport: function() { | |
return (window.Notification) ? true : false; | |
}, | |
requestAuthorization: function() { | |
if (this.checkSupport()) { |