Skip to content

Instantly share code, notes, and snippets.

@mjlescano
mjlescano / jquery.event.stop.js
Last active August 29, 2015 14:07
jQuery event.preventDefault() and event.stopPropagation() shortcut.
/**
jQuery.Event.stop extension
===========================
Simple shortcut to do:
$(document).on('click', 'a', function(e){
return e.stop()
})
@mjlescano
mjlescano / form-reset-helpers.scss
Last active November 30, 2022 16:08 — forked from anthonyshort/Super Form Reset.css
Reset for form elements written in SCSS
/* ----------------------------------------------------------------------------------------------------
SCSS Form Reset Helpers - Forked from: https://gist.github.com/anthonyshort/552543
Intended usage:
- MIXINS: for very specific use cases, when you dont want to reset absolutly all the forms, very verbose output.
- PLACEHOLDER SELECTORS: use as extending classes. Less verbose, more generic overrides.
A couple of things to watch out for:
@mjlescano
mjlescano / fbReady.js
Last active August 29, 2015 14:04
fbReady Function, to execute things when facebook asynchronously loaded
;(function(){
// Function to have a list of functions to load on fbAsyncInit
var toLoad = []
window.fbReady = function(func){
window.FB ? func.call(window) : toLoad.push(func)
}
window.fbAsyncInit = function() {
FB.init({
appId: "#{FACEBOOK_API}",
status: true,
@mjlescano
mjlescano / asyncCss.js
Last active August 29, 2015 14:04
Global asyncCss() function to load async stylesheets, can accept callback as second argument that will be executed when all the stylesheets had finished loading. (IE6 compatible in theory.)
;(function(w,d){
var rAF = w.requestAnimationFrame
|| w.mozRequestAnimationFrame
|| w.webkitRequestAnimationFrame
|| w.msRequestAnimationFrame
|| function(f){ f() }
var callbacks = []
var pending = 0
var hasOnload = 'onload' in d.createElement('link')