This file contains hidden or 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
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' |
This file contains hidden or 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
import requests | |
import json | |
import base64 | |
import pprint | |
import unittest | |
import time | |
import datetime | |
# Put this in contactMechList | |
ADDRESS_TEMPLATE = { |
This file contains hidden or 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
/** | |
* 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. |
This file contains hidden or 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 __future__ import absolute_import | |
__author__ = 'Chuck Martin' | |
import os | |
import Tkinter | |
import tkFileDialog | |
def convert_template(file_path=None, out_dir=None): |
This file contains hidden or 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 time import sleep | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.common.action_chains import ActionChains | |
class Chosen(object): | |
""" | |
For selenium testing of the jquery Chosen widget (v1.1.0 https://harvesthq.github.io/chosen/). |
This file contains hidden or 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
__author__ = 'chuck' | |
from urlparse import urlparse | |
from django.core.urlresolvers import reverse | |
from django.test import TestCase | |
from django.test.client import Client | |
from django.conf import settings | |
from django.contrib.auth.models import User, Group | |
from django.core.cache import cache |
This file contains hidden or 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
""" | |
Mostly the Google quickstart.py code with the "freebusy" service running. | |
Also shows how to make datetimes using pytz. | |
Follow these instructions to get access credentials: | |
https://developers.google.com/google-apps/calendar/quickstart/python | |
""" |
This file contains hidden or 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.core.cache import cache | |
from django.core.urlresolvers import reverse | |
from django.contrib.staticfiles.testing import StaticLiveServerTestCase | |
from selenium import webdriver | |
from selenium.webdriver.support.select import Select | |
# DOES NOT WORK WITH selenium 2.5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
This file contains hidden or 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
''' | |
I have a model for customer intake. One of the fields is for tracking how the customer heard about us. I do | |
not want an endless proliferation of values, so I would like to use a multi-select. The problem is I also want the | |
user to add new choices as needed. It turns out this is possible with the Select2 widget: | |
https://select2.github.io/examples.html#tokenizer - check out this link to see how to setup your javascript. | |
It turns out this is a little tricky to implement. Below is a mixin you can use with a form to handle the field. | |
Also, if you are using bootstrap, you will want: https://fk.github.io/select2-bootstrap-css/ |
This file contains hidden or 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
# Gazetteer --------------------------------------------------------------------------------------------------------- | |
def load_deduped_output_for_gazetteer(filename): | |
""" | |
Parse data from dedupe into: | |
1. Canonical dataset (no dupes) | |
2. messy data - all the dupes | |
3. markPairs. | |
:return: |
OlderNewer