Skip to content

Instantly share code, notes, and snippets.

View eventuallyc0nsistent's full-sized avatar

:pie: eventuallyc0nsistent

View GitHub Profile
@eventuallyc0nsistent
eventuallyc0nsistent / filter.py
Last active June 7, 2016 19:32 — forked from thewarpaint/filter.js
Angular filter to convert numbers to thousand suffixes (1234 > 1.2k)
"""
Source: https://gist.github.com/thewarpaint/889690aeb21a8dfd7aba
"""
from __future__ import division
def number_suffixes(number):
suffixes = ['k', 'M', 'G', 'T', 'P', 'E']
if not isinstance(number, int):
return number
if number < 1000:
# DocuSign API Walkthrough 07 (PYTHON) - Embedded Sending
import sys, httplib2, json;
#enter your info:
username = "***";
password = "***";
integratorKey = "***";
templateId = "***";
authenticateStr = "<DocuSignCredentials>" \
@eventuallyc0nsistent
eventuallyc0nsistent / scrapy_webservice_call.py
Created May 22, 2015 16:06
Querying a Scrapy spider with JSON RPC
import requests
url = 'http://localhost:6080/crawler'
# This will call the crawler objects stop method.
# Checkout all the methods the crawler object has:
# https://github.com/scrapy/scrapy/blob/master/scrapy/crawler.py#L24
data = '{"id" : 2, "method" : "stop"}'
# The project has been moved out of scrapy but heres the web service API

##List of state and state codes

Not an official source

State Abbreviation Postal Code
Alabama Ala. AL
Alaska Alaska AK
American Samoa AS
Arizona Ariz. AZ
@eventuallyc0nsistent
eventuallyc0nsistent / selenium-scrapy-guide.md
Last active August 29, 2015 14:06
How to use selenium

###How to selenium

Selenium is a browser automation tool used for testing elements in the browser and can also be used by our dear friend scrapy to scrape elements off the internet.

####Install selenium via pip

Run this command on your system. Make sure you have pip installed. If not then, download and run this python program and then run the command below.

pip install selenium
@eventuallyc0nsistent
eventuallyc0nsistent / dialog.js
Created August 30, 2013 20:32
ajax dialog post
var commentPolicy = function(username,category){
var username = username;
var category = category;
$('.icon-comment').click(function() {
var id = $(this).attr('name');
$("#dialog .policy-comment").val('');
$("#dialog").dialog({