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
<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 / 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) {
// Python style
function Class() {
var self = this;
this.__init__ = function(x, y){
self.x = x;
self.y = y;
};
this.__str__ = function(){
log('<' + self.x + self.y + '>');
@christabor
christabor / gist:c94c527e1c7f7c41322a
Created May 9, 2014 17:50
Clean django field with specified file type
def clean_data(self):
filetype = self.cleaned_data['data'].content_type
if not filetype == 'application/pdf':
raise forms.ValidationError(
'"{}" is not a valid file. Please upload a valid .PDF.')
else:
return self.cleaned_data['data']
@christabor
christabor / chainable
Created July 1, 2014 20:26
Fake chaining practice - js
var d3 = function(){
var self = this;
this.foo = function() {
return this;
};
this.range = function(max) {
var x = [];
for(var i = 0 ; i < max; i++) {
x.push(i);
}
@christabor
christabor / gist:8d1313a29ee5323b7146
Created July 2, 2014 22:53
Boostrap bg status padding
/* Bootstrap overrides */
.bg-primary,
.bg-success,
.bg-info,
.bg-warning,
.bg-danger {
padding: 1em;
}
@christabor
christabor / gist:720c16ef57f2becfe5af
Created July 2, 2014 23:20
Apply widgets to many fields in django form easily and DRYly
class ...
class Meta:
_textarea = forms.Textarea(attrs={'cols': 40, 'rows': 5})
model = models.MyModel
widgets = {
'field1': _textarea,
'field2': _textarea,
'field3': _textarea,
'field4': _textarea,
}
@christabor
christabor / logolounge-trends-scraper
Created July 7, 2014 08:05
Pyquery scraper for logolounge.com Logo Trends data.
@christabor
christabor / hack-refactor
Created July 15, 2014 20:29
css refactor hack
// use @hack to specify all selectors that should be removed at a later point in time!
// @hack
#shitty-overqualified-id {
font-size: 12.em;
}
// @hack
#another-overqualified-id {
padding: 1.3m;
}