Skip to content

Instantly share code, notes, and snippets.

View liddiard's full-sized avatar
🙃

Harrison Liddiard liddiard

🙃
View GitHub Profile
@liddiard
liddiard / add_domains.py
Last active December 24, 2015 10:59
Bulk import domain names into Heroku
import os, sys, getpass
from requests.exceptions import HTTPError
import heroku
# var initialization
try:
my_app = sys.argv[1]
domains_file = sys.argv[2]
except IndexError:
print "\nUsage: ~$ python add_domains.py app_name domains_to_add.txt\n"
@liddiard
liddiard / .vimrc
Last active December 25, 2015 11:18
" Necesary for lots of cool vim things
set nocompatible
" Syntax highlighting
syntax on
" Improve indents
set smartindent
set tabstop=4
set shiftwidth=4
@liddiard
liddiard / __init__.py
Created November 3, 2013 01:49
Django: different settings for development and production environments. Expects base.py and local.py settings files. local.py should be .gitignore'd. From http://gettingstartedwithdjango.com/en/lessons/introduction-and-launch/.
from .base import *
try:
from .local import *
except ImportError:
pass
@liddiard
liddiard / dusk.js
Last active December 31, 2015 14:39
F.lux for the web
// requires jQuery
function Color(r,g,b,a) {
this.r = parseInt(r);
this.g = parseInt(g);
this.b = parseInt(b);
this.a = parseFloat(a);
}
Color.prototype.rgb = function() {
@liddiard
liddiard / import.py
Created January 18, 2014 16:28
Working on parsing ratings data from imdb with regex
(?:\s+(?P<rating>\d\.\d)\s+(?P<show_name>\".*)(?=\n.* {))(?:\n.*?\s+(\d\.\d)\s+.*?{(.*)})
@liddiard
liddiard / gist:4469a0f8ed5542065cad
Created January 18, 2014 23:14
showstarter imdb import
import sys
ENTRY_START = 297
RATING_RANGE = (20, 24)
TITLE_START = 26
input_file = sys.argv[1]
with open(input_file, 'r') as f:
entries = [line.strip() for line in f]
@liddiard
liddiard / bulkregister_extract.js
Last active August 29, 2015 13:57
Extract a list of domain names from a BulkRegister page with jQuery.
var domains = "";
$('#ctl00_Main_ctl01_pnlResults tr td:nth-child(2) a').each(function(){
domains += $(this).text() + '\n';
});
console.log(domains);
(function($) {
/*!
A very simplified version of:
Name: Reading Time
Dependencies: jQuery
Author: Michael Lynch
Author URL: http://michaelynch.com
Date Created: August 14, 2013
Date Updated: January 24, 2014
@liddiard
liddiard / base.html
Created September 14, 2014 06:20
Boilerplate base HTML for Django
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{% block meta_description %}Default meta description here.{% endblock %}">
<title>{% block title %}Default title here{% endblock %}</title>
<link rel="icon" type="image/x-icon" href="{{ STATIC_URL }}img/favicon.ico">
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/main.css">
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
hliddiard@ubuntu:~$ npm update -g yo
npm http GET https://registry.npmjs.org/yo
npm http 304 https://registry.npmjs.org/yo
hliddiard@ubuntu:~$ yo --version
1.1.2
hliddiard@ubuntu:~$