Skip to content

Instantly share code, notes, and snippets.

View pgarciacamou's full-sized avatar
:octocat:

Pablo Garcia pgarciacamou

:octocat:
View GitHub Profile
@pgarciacamou
pgarciacamou / transition.js
Last active August 29, 2015 14:15
Transition detector constructor. Detects when an element had a transition and executes a callback when it ends.
var Transition = (function (){
var transitionEvent = (function whichTransitionEvent(){
var t, el = document.createElement("fakeelement")
,transitions = {
"WebkitTransition": "webkitTransitionEnd",
"MozTransition": "transitionend",
"OTransition": "oTransitionEnd",
"transition": "transitionend"
};
@pgarciacamou
pgarciacamou / elem.js
Created February 18, 2015 19:22
Mini jQuery esque selector.
function elem(selector){ return document.querySelectorAll(selector); }
Object.defineProperties(NodeList.prototype, {
'each': {
value: function(fn){
var self = this;
Array.prototype.slice.call(this, 0).forEach(function (){
fn.apply(arguments[0], arguments);
});
return self;
}