Skip to content

Instantly share code, notes, and snippets.

View jalbertbowden's full-sized avatar

albert jalbertbowden

View GitHub Profile
import os
def split(filehandler, delimiter=',', row_limit=10000,
output_name_template='output_%s.csv', output_path='.', keep_headers=True):
"""
Splits a CSV file into multiple pieces.
A quick bastardization of the Python CSV library.
Arguments:
@jalbertbowden
jalbertbowden / google_twunter_lol
Last active August 29, 2015 14:25 — forked from jamiew/google_twunter_lol
All the dirty words from Google's "what do you love" project: http://www.wdyl.com/
easterEgg.BadWorder.list={
"4r5e":1,
"5h1t":1,
"5hit":1,
a55:1,
anal:1,
anus:1,
ar5e:1,
arrse:1,
arse:1,
@jalbertbowden
jalbertbowden / opentable_client.rb
Last active August 29, 2015 14:27 — forked from sosedoff/opentable_client.rb
OpenTable API Client - Visit http://opentable.herokuapp.com for details
require "faraday"
require "faraday_middleware"
module OpenTable
class Error < StandardError ; end
module Request
API_BASE = "http://opentable.herokuapp.com"
def connection
@jalbertbowden
jalbertbowden / .prompt
Last active September 16, 2015 19:25 — forked from heyitsolivia/.prompt
.prompt
# git prompt
# from http://gist.github.com/47364
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "⚡"
}
function git_prompt {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1='\[\e[1;33m\]\W\[\e[1;36m\]$(git_prompt)\[\e[1;33m\]$\[\e[m\] '
@jalbertbowden
jalbertbowden / what-forces-layout.md
Created September 23, 2015 16:42 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@jalbertbowden
jalbertbowden / gist:a055ff57c2e38eda8592
Created September 25, 2015 16:34 — forked from atomotic/gist:c3d9c3c6ef8210664371
get the latest snapshot url archived by internetarchive waybackmachine

add to your .zshrc/.bashrc this function (jq is required)

function ia-latest() { curl -s http://archive.org/wayback/available\?url=$* | jq -r '.archived_snapshots.closest.url' }

run

$ ia-latest http://twitter.com/atomotic
http://web.archive.org/web/20131230143739/https://twitter.com/atomotic
#!/usr/bin/env bash
# Wayback machine downloader
#TODO: Remove redundancy (download only newest files in given time period - not all of them and then write over them)
############################
clear
#Enter domain without http:// and www.
domain="google.com"
#Set matchType to "prefix" if you have multiple subdomains, or "exact" if you want only one page
matchType="domain"
@jalbertbowden
jalbertbowden / bookmarklet-js.html
Created September 25, 2015 16:35 — forked from nfreear/bookmarklet-js.html
Nick's bookmarklet Javascripts.
<!doctype html> <title>*Bookmarklets / bookmark Javascripts (applet, favelet)</title>
<style>
body { font: 1.05em sans-serif; }
#bookmarks li { margin-top: 8px; }
#bookmarks a {
cursor: auto;
cursor: /*alias,*/ url(https://developer.mozilla.org/@api/deki/files/810/=Popicon_1.gif), auto;
cursor: move;
(function(){
document.location.href="https://web.archive.org/web/*/"+document.location.href;
})();
@jalbertbowden
jalbertbowden / pbic_pricing_scraper.py
Created November 13, 2015 22:58 — forked from rdempsey/pbic_pricing_scraper.py
A simple Python web scraper to obtain pricing data from the Packt website
#!/usr/bin/env python
# encoding: utf-8
"""
pbic_pricing_scraper.py
Created by Robert Dempsey on 09-29-2015
Copyright (c) 2015 Robert Dempsey. All rights reserved.
Utility script to obtain the price information for my book: Python Business Intelligence Cookbook
http://pythonbicookbook.com/
"""