This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tastypie.exceptions import NotFound | |
from tastypie.resources import ModelResource | |
from tastypie.authentication import BasicAuthentication, ApiKeyAuthentication | |
from tastypie.models import ApiKey, create_api_key | |
from django.contrib.auth.models import User | |
# listen for post_save signal on User model & trigger a function to generate the API key | |
models.signals.post_save.connect(create_api_key, sender=User) | |
# callable that takes allowed methods for production but returns POST & GET verbs if testing w/ localhost or debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var FadeTransitionRegion = Backbone.Marionette.Region.extend({ | |
show: function(view){ | |
this.ensureEl(); | |
view.render(); | |
this.close(function() { | |
if (this.currentView && this.currentView !== view) { return; } | |
this.currentView = view; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* L.TileLayer is used for standard xyz-numbered tile layers. | |
*/ | |
L.Google = L.Class.extend({ | |
includes: L.Mixin.Events, | |
options: { | |
minZoom: 0, | |
maxZoom: 18, | |
tileSize: 256, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pre-requisites: | |
// 1. Device core plugin | |
// 2. Splashscreen core plugin (3.1.0) | |
// 3. config.xml: <preference name="AutoHideSplashScreen" value="false" /> | |
// 4. config.xml: <preference name="DisallowOverscroll" value="true" /> | |
function onDeviceReady() { | |
if (parseFloat(window.device.version) >= 7.0) { | |
document.body.style.marginTop = "20px"; | |
// OR do whatever layout you need here, to expand a navigation bar etc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FadeTransitionRegion = Backbone.Marionette.Region.extend | |
show: (view)-> | |
@ensureEl() | |
view.render() | |
@close -> | |
return if @currentView and @currentView isnt view | |
@currentView = view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.3.4) | |
// Compass (v1.0.0.alpha.18) | |
// ---- | |
// Jeet 5 - http://jeet.gs | |
/* Syntax Quick Reference | |
-------------------------- | |
column($ratios: 1, $offset: 0, $cycle: 0, $uncycle: 0, $gutter: jeet(gutter)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FadeTransitionRegion = Backbone.Marionette.Region.extend | |
show: (view)-> | |
@ensureEl() | |
view.render() | |
@close -> | |
return if @currentView and @currentView isnt view | |
@currentView = view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from tastypie.throttle import CacheDBThrottle | |
class SmartCacheDBThrottle(CacheDBThrottle): | |
""" | |
Custom throttling class to address bug in Tastypie that manifests | |
when trying to run tests or do any kind of development with a Resource | |
that has some kind of throttling configured. Tastypie is not smart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Artist = Backbone.Model.extend(); | |
var Artists = Backbone.Collection.extend({ | |
model : Artist, | |
url : "http://api.discogs.com/database/search?type=artist", | |
sync : function(method, collection, options) { | |
// By setting the dataType to "jsonp", jQuery creates a function | |
// and adds it as a callback parameter to the request, e.g.: | |
// [url]&callback=jQuery19104472605645155031_1373700330157&q=bananarama | |
// If you want another name for the callback, also specify the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TODAY=`date +%Y-%m-%d` | |
LIST=$(cat lunch.txt | perl -MURI::Escape -ne 'print uri_escape($_)') | |
curl -s \ | |
-d "list=$LIST" \ | |
-d "format=plain" \ | |
-d "rnd=date.$TODAY" \ | |
"https://www.random.org/lists/?mode=advanced" |
OlderNewer