Skip to content

Instantly share code, notes, and snippets.

View matthewwithanm's full-sized avatar

Matthew Dapena-Tretter matthewwithanm

View GitHub Profile

Keybase proof

I hereby claim:

  • I am matthewwithanm on github.
  • I am matthewwithanm (https://keybase.io/matthewwithanm) on keybase.
  • I have a public key whose fingerprint is C99A 0F77 E5B6 A603 6663 E8A6 88BC 3269 0976 5393

To claim this, I am signing this object:

@matthewwithanm
matthewwithanm / Conquering State.md
Last active March 28, 2017 15:13
Conquering State: Why ReactJS (or something like it) is the Future of Front-end

Conquering State

Why ReactJS (or something like it) is the Future of Front-end

A high-level overview of the concepts behind React and why it's not Just Another Framework.

Slides available [on Speaker Deck][1]

@matthewwithanm
matthewwithanm / coffeelint.json
Last active January 2, 2016 10:29
An HZ CoffeeLint Configuration Proposal
{
"arrow_spacing": {
"level": "error"
},
"camel_case_classes": {
"level": "error"
},
"coffeescript_error": {
"level": "error"
},
@matthewwithanm
matthewwithanm / gist:7772304
Created December 3, 2013 16:27
Google Analytics Event Tracking w/Callbacks & Timeout
# A simple "once" implementation. Can be replaced with _.once or similar.
once = (func) ->
ran = false
->
return if ran
ran = true
func.apply this, arguments
func = null
undefined
@matthewwithanm
matthewwithanm / remedy.less
Last active December 22, 2015 12:08
An ugly hack to use rems with pixel fallbacks for any CSS property.
//
// Usage:
//
// @import 'remedy.less';
// @remedy-base-size: 16px;
// .something {
// .remedy('font-size'; 12px);
// .remedy('margin'; 1.2rem 3rem);
// }
//
@matthewwithanm
matthewwithanm / models.py
Last active December 12, 2015 07:49
ImageSpec with Suffixed Filenames
from django.db import models
from imagekit import ImageSpec
from imagekit.models import ImageSpecField
from imagekit.utils import get_field_info
from imagekit import register
import os
class TvSpec(ImageSpec):
suffix = '-tv'
@matthewwithanm
matthewwithanm / :(.js
Created April 21, 2012 14:57
Difficulties with JSON Association Technique
// 1. Relying on pluralization can be tricky.
var payload = {
"deer": {
"id": 1,
"name": "Bambi",
"related_deer": [1, 2, 3]
},
"deerses": [ // ????
{"id": 2, ...},
@matthewwithanm
matthewwithanm / models.py
Created March 19, 2012 23:25
Burakk's Image Model (Simplified)
from django.db import models
from imagekit.processors import *
from imagekit.models.fields import ImageSpecField
import os
def get_thumb_processors(instance, file):
return [resize.ResizeToFill(width=instance.thumb_width,
height=instance.thumb_height)]
@matthewwithanm
matthewwithanm / async.py
Created February 11, 2012 05:55
Cache State Backend
# -*- coding: utf-8 -*-
from celery.task import task
from imagekit.cachestate import PessimisticCacheStateBackend
@task
def generate(model, pk, attr):
try:
instance = model._default_manager.get(pk=pk)
except model.DoesNotExist: