Skip to content

Instantly share code, notes, and snippets.

View cwurld's full-sized avatar

Chuck Martin cwurld

View GitHub Profile
@cwurld
cwurld / convert_template.py
Last active August 29, 2015 14:11
Converts a Django page template into a page template for a Django project template
from __future__ import absolute_import
__author__ = 'Chuck Martin'
import os
import Tkinter
import tkFileDialog
def convert_template(file_path=None, out_dir=None):
@cwurld
cwurld / fix_chosen.js
Created December 4, 2014 23:22
For Fixing Chosen Selects Created by Django Dynamic Formsets
/**
* Created by Chuck Martin on 12/4/14.
*
* When django-dynamic-formset creates a new formset and that formset used the "Chosen" widget
* (http://harvesthq.github.io/chosen/), the newly created Chosen widget does not work right.
*
* This code solves that problem by replacing the select (along with the chosen code) that was cloned with a new
* select created from scratch.
*
* This function returns a function for creating a new select that can be associated with Chosen.
@cwurld
cwurld / finale_api.py
Last active March 9, 2022 17:16
Python for Accessing Finale Inventory REST API
import requests
import json
import base64
import pprint
import unittest
import time
import datetime
# Put this in contactMechList
ADDRESS_TEMPLATE = {
@cwurld
cwurld / ccm_python-flckr.py
Created April 29, 2013 18:18
How to POST a photo to Flickr using Python The Flickr api docs are OK, but lacking in detail about how to post a photo once you complete the oauth process. Matt Kelsey has a nice blog post about basic oauth process with Flickr: http://mkelsey.com/2011/07/03/Flickr-oAuth-Python-Example/. Read his blog first. I should mention that I tried using Py…
import time
import oauth2 as oauth
import requests # From: http://docs.python-requests.org/en/latest/
# oauth_token and oauth_token_secret are the tokens produced at the end of the Flickr oauth process
token = oauth.Token(oauth_token, oauth_token_secret)
photo_url = 'http://api.flickr.com/services/upload'