Skip to content

Instantly share code, notes, and snippets.

View xmalinov's full-sized avatar
:octocat:
Procrastination must die!

Alexander Malinov xmalinov

:octocat:
Procrastination must die!
View GitHub Profile
@xmalinov
xmalinov / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@xmalinov
xmalinov / gist:9c1279e0217dd6ce0f07
Last active August 29, 2015 14:05 — forked from HashNuke/gist:608259
Undo a git push
# to undo a git push
git push -f origin HEAD^:master
# to get to previous commit (preserves working tree)
git reset --soft HEAD
# to get back to previous commit (you'll lose working tree)
git reset --hard HEAD^
//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence
(function(win, doc){
if(win.addEventListener)return; //No need to polyfill
function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}}
function addEvent(on, fn, self){
return (self = this).attachEvent('on' + on, function(e){
var e = e || win.event;
e.preventDefault = e.preventDefault || function(){e.returnValue = false}
e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true}
// ----------------------------------------------------------
// A short snippet for detecting versions of IE:
// Uses a combination of object detection and user-agent
// sniffing.
// ----------------------------------------------------------
// If you're not in IE then:
// ie === NaN // falsy
// If you're in IE then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE: