git add .
git add /path/to/file
git reset
unstage all files
git reset /path/to/file
unstage specific file
const previous = currentIndex => { | |
const { items, setActiveId } = this.props | |
const index = (currentIndex - 1 + items.length) % items.length | |
setActiveId(items[index].id) | |
} | |
const next = currentIndex => { | |
const { items, setActiveId } = this.props | |
const index = (currentIndex + 1) % items.length | |
setActiveId(items[index].id) |
function parseVideoURL(url) { | |
function getParm(url, base) { | |
var re = new RegExp("(\\?|&)" + base + "\\=([^&]*)(&|$)"); | |
var matches = url.match(re); | |
if (matches) { | |
return(matches[2]); | |
} else { | |
return(""); | |
} |
/** | |
* Minimal CSS selector engine for modern browsers. | |
* @param {String} selector A string containing a selector expression. | |
* @param {Node=} opt_context The context to search within. | |
* @returns {Node|NodeList} An element or list of matched elements. | |
*/ | |
window.$$ = function(selector, opt_context) { | |
var context = opt_context || document; | |
var results = context.querySelectorAll(selector); |
var videoURL = 'http://www.youtube.com/watch?v=jkWWJ9W5300'; | |
var videoID = videoURL.replace(/.*youtube.*watch.*v=([a-zA-Z0-9-_]+).*/,'$1'); |
var root = location.protocol + '//' + location.host; |
if(window.addEventListener) { // correlates with media query support | |
var timer = false | |
, resize_monitor = function() { | |
if(timer) { | |
clearTimeout(timer); | |
} | |
timer = setTimeout(function() { _gaq.push(['_trackEvent', 'Resize', 'Resize', 'Resized']); }, 100); | |
// or log a pageview on a non-existant page if you prefer |
function hideAddressBar() { | |
if( /iphone|ipod|android/gi.test( navigator.userAgent ) && !/crios/gi.test( navigator.userAgent ) ) { | |
window.addEventListener( 'load', removeAddressBar, false ); | |
window.addEventListener( 'orientationchange', removeAddressBar, false ); | |
} | |
} |
function htmlEncode(value){ | |
return $('<div/>').text(value).html(); | |
} |
$.fn.serializeObject = function() { | |
var o = {}; | |
var a = this.serializeArray(); | |
$.each(a, function() { | |
if (o[this.name] !== undefined) { | |
if (!o[this.name].push) { | |
o[this.name] = [o[this.name]]; | |
} | |
o[this.name].push(this.value || ''); | |
} else { |