Skip to content

Instantly share code, notes, and snippets.

View destos's full-sized avatar

Patrick Forringer destos

View GitHub Profile
@destos
destos / bird_api.json
Created June 9, 2015 05:04
Example of the bird API
[
{
"id": 1,
"name": "Waterfowl (Ducks, Geese, Swans)",
"order": 0,
"vispedia_id": "svqCRQQpMbCZumzhwxhEuC",
"children": [
2,
3,
4,
@destos
destos / example_migration.py
Created April 9, 2015 19:36
How to add waffle flags to your Django Migrations
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
flag_name = 'the_flag_is_nigh'
Flag = models.get_app('waffle').Flag
@destos
destos / awsup.py
Last active August 29, 2015 13:58 — forked from buddylindsey/awsup.py
import sys
import boto
from boto.s3.connection import S3Connection
from boto.s3.key import Key
file_name = sys.argv[1]
AWSAccessKeyId = ''
AWSSecretKey = ''
@destos
destos / uploads-tests.coffee
Created February 18, 2014 15:48
Angular Angular File upload lib multiple endpoint/file handler.
describe 'UploadList', ->
beforeEach ->
angular.mock.module('ca.uploads')
angular.mock.module('angularLocalStorage.mock')
beforeEach inject ($rootScope, $controller, $http, $httpBackend, $upload, $timeout, mockStore) ->
@scope = $rootScope.$new()
@httpBackend = $httpBackend
@callbacks =
success: sinon.stub()
@destos
destos / Stylesheet Editor.css
Created January 28, 2014 14:55
Disqus comment box width on 2014
#disqus_thread {
padding: 12px 10px 0;
margin: 0 auto;
max-width: 474px;
}
@media screen and (min-width: 673px) {
#disqus_thread {
padding-left: 30px;
padding-right: 30px;
#disqus_thread {
padding: 12px 10px 0;
margin: 0 auto;
max-width: 474px;
}
@media screen and (min-width: 673px) {
#disqus_thread {
padding-left: 30px;
padding-right: 30px;
@destos
destos / directives.coffee
Created August 30, 2013 16:39
A useful directive for having a callback function for file input elements.
angular.module('directives.fileWatcher', [])
.directive('fileWatcher', ($parse) ->
restrict: 'A'
scope:
fileWatcher: '&'
link: (scope, element, attrs) ->
if not element.is(':file')
throw new Error('fileWatcher directive must be attached to a file input element.')
if attrs.fileWatcher is ''
throw new Error('fileWatcher needs a callback function for adding files')
@destos
destos / dalek.app
Created December 15, 2012 21:35 — forked from Faeranne/dalek.app
var osc = require('node-osc');
var io = require('socket.io-client');
var socket = io.connect('tulsadalek.com', function() {
console.log(arguments);
})
var OSCclient = osc.Client('127.0.0.1', 9001);
socket.on('connect', function(){
@destos
destos / gist:1839779
Created February 15, 2012 22:51
get_post_type_template
function get_post_type_template( $context = null ) {
$type = (string) get_post_type( get_the_ID() );
$format = (string) get_post_format( get_the_ID() );
do_action( "get_post_type_template_{$type}", $format, $context );
$templates = array();
if ( !empty($format) ){
@destos
destos / gist:1426373
Created December 3, 2011 07:14 — forked from codeboost/gist:1424465
Convert Mongoose obj to JS obj and all ObjectIds to String
toObject = (item) ->
return item unless item.toObject
json = item.toObject()
for key, val of json
if _.isArray val
json[key] = _.map val, (element) -> toObject element
else