Skip to content

Instantly share code, notes, and snippets.

View mandelbro's full-sized avatar
🌀

Chris Montes mandelbro

🌀
View GitHub Profile
@mandelbro
mandelbro / Development Questionnaire
Last active December 20, 2015 15:28
This is the questionnaire I use for starting new web development projects, chiefly when I am taking a project over from design.
#########################################################################################
# _ _ _ ______ _____ _ _ #
# | | | | | | | _ \ | _ | | | (_) #
# | | | | ___| |__ | | | |_____ __ | | | |_ _ ___ ___| |_ _ ___ _ __ ___ #
# | |/\| |/ _ \ '_ \ | | | / _ \ \ / / | | | | | | |/ _ \/ __| __| |/ _ \| '_ \/ __| #
# \ /\ / __/ |_) | | |/ / __/\ V / \ \/' / |_| | __/\__ \ |_| | (_) | | | \__ \ #
# \/ \/ \___|_.__/ |___/ \___| \_/ \_/\_\\__,_|\___||___/\__|_|\___/|_| |_|___/ #
# #
#########################################################################################
@mandelbro
mandelbro / jQuery Media Query List Events
Created April 14, 2013 22:34
Triggers jQuery events when some key mediaQuery breakpoints are hit
(function($){
$(function() {
var mqls = [window.matchMedia("(min-width: 1900px)"), window.matchMedia("(max-width: 780px)"), window.matchMedia("(max-width: 480px)")],
handleOrientationChange = function(mql) {
switch(mql.media) {
case '(min-width: 1900px)' :
@mandelbro
mandelbro / jQuery flexiFrame plugin
Last active December 15, 2015 06:39
When you set an iFrame to max-width 100%, it can't adjust it's own height. That is because iFrames are stupid, this plugin is like a 4 year education to an iFrame, which the iFrame will squander anyway.
(function($) {
var methods = {
adjustHeight : function(ratio, width) {
if(width == currentWidth) return;
currentWidth = width;
this.height(width/ratio);
}
},
currentWidth;
@mandelbro
mandelbro / not-the-konami-code.js
Last active December 15, 2015 05:38
This definitely isn't a jQuery snippet to enable the Konami code on your site...
(function($) { // make this friendly to other libraries
$(function() {
var theCode = { // what code, I don't know what code you're talking about...
sequence: new Array(38,38,40,40,37,39,37,39,66,65,13), //
index: 0
};
$('body').on('keyup', function(event) {
//changed from 'keydown' so the function triggers on release of the key instead of as soon as its pressed
@mandelbro
mandelbro / jQuery-transitionend
Created November 13, 2012 19:40
Quick jQuery plugin to get the duration of a CSS transition for an element
(function( $ ) {
/**
* jQuery.transtionend
* Retrievs the total amount of time, in miliseconds that
* an element will be transitioned
*/
$.fn.transtionend = function() {
@mandelbro
mandelbro / Email Login with D6
Created June 18, 2012 01:20
Enable login with user id or email in Drupal 6
/**
* Implements hook_form_alter
*/
function trnAccount_form_alter(&$form, &$form_state, $form_id) {
global $user;
switch($form_id) :
case 'user_login':
// build the validators array
@mandelbro
mandelbro / gist:2723479
Last active October 5, 2015 00:28
simple jQuery plugin to enable the hover state on non-standard elements, I mostly use it for adding a hover state to li elements in menus
/**
* hoverEnabler
* @mandelbro 05/16/2012
*
* A simple solution to adding css hover effects to elements
* in a cross browser capatable way
*
* Just add the .hoverEnabler class to any element which lacks