Skip to content

Instantly share code, notes, and snippets.

View christabor's full-sized avatar
😅
I may be slow to respond.

Chris Tabor christabor

😅
I may be slow to respond.
View GitHub Profile
@christabor
christabor / gist:4601197
Created January 23, 2013 02:04
jQuery contextLoader - a DOM - contextual loader for your web app!
/*
======================
USAGE
======================
createLoadPane is a simple function that handles creation and positioning,
as well as text options for adding "contextual loaders" into the dom --
a loader that covers a certain area where content may be loading via ajax.
This works with the box-model and takes the basic discrepencies into account.
@christabor
christabor / input-number-visual-centering
Last active December 20, 2015 07:19
visually centering text on input:number
// the input type = number looks uncentered, even with the standard text-align:center -- because of the width of the buttons on the right. This will not be technically centered, but appear visually so.
// percentages account for variable size
input[type="number"] {
text-align:center;
text-indent: 10%;
}
@christabor
christabor / gist:6141749
Created August 2, 2013 17:35
Create a bunch of jquery sliders by mapping over an object of enumerable properties
// you can put your functions outside (my preference) or inside the object itself.
function foo() {
console.log('foo!');
}
function bar() {
console.log('bar!');
}
@christabor
christabor / try-catch-js-design-pattern
Created September 24, 2013 18:06
JS Pattern: Try/catch a bunch of modules at once
// a global module and namespace, preferably separated by individual files for each sub-module
var myGlobalObject = {
category: {
function1: function() {alert('function 1!');},
function2: function() {alert('function 2!');},
function3: function() {alert('function 3!');},
function4: function() {alert('function 4!');}
}
};
@christabor
christabor / rebase-gh-pages
Created October 18, 2013 16:32
quickly rebase gh-pages (bash)
alias rebpages="git checkout gh-pages && git rebase master && git push origin gh-pages && git checkout master"
@christabor
christabor / python httpserver + chrome mac cli
Created November 19, 2013 19:02
Serve files locally and open chrome in Mac CLI
alias pserve="open /Applications/Google\ Chrome.app http://localhost:8001 && python -m SimpleHTTPServer 8001"
<a href="#" data-load-css="wtf.css" data-load-fn="wtfFn">Some module link</a>
<form action="">
<button data-load-css="wtf2.css" data-load-fn="wtf2Fn">Yeah buddy</button>
</form>
var moduleFuncs = {
wtfFn: function() {},
wtf2Fn: function() {}
};
@christabor
christabor / fizzbuzz
Last active February 11, 2018 15:48
Fizzbuzz SASS (SCSS)
// To generate the html, I use an expansion tool like Emmett and run:
// ul#fuzzbuzz>li$num*100
@mixin fizzbuzz-content($num) {
@if $num % 15 == 0 {
content: 'FizzBuzz';
}
@elseif $num % 5 == 0 {
content: 'Buzz';
}
@christabor
christabor / Greek-constants
Last active August 29, 2015 13:57
Constants as greek
var τ = Math.PI * 2;
var Θ = 30;
var λ = function(){};
var ψ = ['z^0', 'z^1', '...'];
var Δ = function(thing1, thing2){return Math.abs(thing1-thing2);};
alert(Θ);
alert(τ);
alert(λ);
alert(ψ);
@christabor
christabor / oldmixins
Last active August 29, 2015 13:58
Some old mixins from automotron.com
// MIT LICENSE - use for whatever!
@mixin transition($property, $time, $easing) {
-moz-transition: $property $time $easing;
-webkit-transition: $property $time $easing;
-o-transition: $property $time $easing;
transition: $property $time $easing;
}
@mixin column-count($gap, $count) {