Skip to content

Instantly share code, notes, and snippets.

View mpjura's full-sized avatar

Mike Pjura mpjura

  • Hearst Digital Media
  • NY
View GitHub Profile
@mpjura
mpjura / transitionend-event-map.js
Created February 8, 2013 17:42
Transition End Event Name Map. Uses Modernizr.
var transEndEvent = {
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition' : 'transitionend',
'OTransition' : 'oTransitionEnd otransitionend',
'msTransition' : 'MSTransitionEnd',
'transition' : 'transitionend'
}[ Modernizr.prefixed('transition') ];
@mpjura
mpjura / mediator.js
Last active December 14, 2015 12:09
Mediator Mixin
var Mediator = {
channels: {},
subscribe: function( channel, fn, ctx ){
var channels = this.channels;
if ( !channels[ channel ] ){ channels[ channel ] = []; }
channels[ channel ].push({ context: ctx || this, callback: fn });
@mpjura
mpjura / SassMeister-input.scss
Created January 18, 2016 13:46
Generated by SassMeister.com.
// ----
// libsass (v3.3.2)
// ----
%placeholder {
width: 100px;
height: 100px;
}
%placeholder {
@mpjura
mpjura / constant.js
Last active May 3, 2016 20:11
Constants Implementation
define( "constants", [ "utils" ], function( Utils ) {
/**
* _constants is a private object that will hold the
* constant values. Hidden behind a closure to prevent
* modules from changing "constant" values once set.
* @type {Object}
*/
var _constants = {},
/**
@mpjura
mpjura / override-document-write.js
Last active August 29, 2020 04:51
Override document.write
(function() {
var old = document.write;
document.write = function( content ) {
if ( "interactive" === document.readyState ) {
console.log("document.write called after page load: ", content );
// optional.. safely append the content
// document.body.appendChild( content );
return;
}