Skip to content

Instantly share code, notes, and snippets.

View cmsimike's full-sized avatar

Mike Megally cmsimike

  • Los Angeles, CA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am cmsimike on github.
  • I am cmsimike (https://keybase.io/cmsimike) on keybase.
  • I have a public key whose fingerprint is 30BE B5C7 6C8B C855 62C3 E996 9DB9 E2D1 4D57 E30F

To claim this, I am signing this object:

model:
class Subscription(models.Model):
user = models.ForeignKey(User)
stripe_id = models.CharField(max_length=255)
subscribed = models.BooleanField(default=False)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
expires = models.DateTimeField(null=True, blank=True)
def save(self, *args, **kwargs):
@cmsimike
cmsimike / gist:2418140
Created April 19, 2012 03:13
disable css and js caching on the client for development
<IfModule mod_headers.c>
<FilesMatch "\.(css|js)$">
Header set Cache-Control "no-store"
</FilesMatch>
</IfModule>
$ sudo a2enmod headers
@cmsimike
cmsimike / callable.py
Created April 11, 2012 07:39 — forked from durden/callable.py
Clever way to use Python __call__ and __getattr__ to create web APIs that can map directly (dynamically) to actual API
class MyCallable(object):
def __init__(self, urlparts, callable):
self.urlparts = urlparts
self.callable = callable
def __call__(self, **kwargs):
print kwargs
print self.urlparts
def __getattr__(self, name):
# Return a callable object of this same type so that you can just keep
# chaining together calls and just adding that missing attribute to the
@cmsimike
cmsimike / rcs.py
Created January 4, 2012 17:48
random code sample
if item == None:
item = Instance()
item.populate(context)
+ config.vm.provision :puppet do |puppet|
+ puppet.manifests_path = "website/setup/manifests"
+ puppet.manifest_file = "lucid32.pp"
+ puppet.module_path = "website/setup/modules"
+ puppet.options = "--modulepath /tmp/vagrant-puppet/modules-0"# --verbose --debug"
+ end