Skip to content

Instantly share code, notes, and snippets.

View poteto's full-sized avatar
🥔
ポテト

lauren poteto

🥔
ポテト
View GitHub Profile
@poteto
poteto / extract_filetype_from_zip.py
Created May 17, 2012 18:18
extract all files of filetype from many zip files
# extract_filetype_from_zip.py
# A simple script to extract all files of a certain filetype from many .zip files
# * Requires Python installed on local computer
VERSION = 0.1
#
# Place this file in the folder where you have all your zipfiles.
# Example use:
# - To extract only PDFs: extract_filetype('.pdf', '/folder') where folder (with the /) is the dir you store your zipfiles
# - 2nd argument is optional (defaults to root)
@poteto
poteto / ip_lookup.py
Created May 27, 2012 13:37
Batch IP Geolocation script
#!/usr/bin/python
# ip_lookup.py by poteto
#
# Batch processes many IP addresses, and traces their geolocation.
# The script outputs a .txt file which is then renamed to .csv, and is usable in Excel
#
# Use:
# 1. Save your user email and IP addresses in a .csv file
# - Each email and IP should be in its own column in Excel (or separated by commas)
# - Enter the name of your .csv file:
@poteto
poteto / new-pg-db.md
Created August 24, 2012 08:48
new postgres db on local machine

Creating a new local pg database:

$ sudo su - postgres
# log in as postgres

$ createuser
# Enter name of role to add: username
# Shall the new role be a superuser? (y/n) n
# Shall the new role be allowed to create databases? (y/n) n
@poteto
poteto / collapse.css
Created September 5, 2012 08:12 — forked from dbieber/collapse.css
Collapsible Blog Posts
/* CSS for Collapsible Blog Posts */
[id^=_] {
display: none;
}
@poteto
poteto / rails-postgres-bigint-migration.rb
Created September 15, 2012 14:57
[rails] postgres bigint migration
# working with big integers over 4 bytes
# see http://www.postgresql.org/docs/9.2/interactive/datatype-numeric.html#DATATYPE-NUMERIC-TABLE
class CreateModel < ActiveRecord::Migration
def change
create_table :model do |t|
t.column :xxx, :bigint
t.timestamps
end
@poteto
poteto / devise-oauth.md
Created September 15, 2012 15:38
[rails] using devise and oauth

Rails user authentication using Devise and Omniauth (OAuth). (Note that the Dropbox API uses OAuth v1)

First in Gemfile:

gem 'devise'
gem 'omniauth'
gem 'omniauth-dropbox'
@poteto
poteto / spaghetti_carbonara.rb
Created September 18, 2012 15:13
Cooking for Programmers: Spaghetti Carbonara
class Recipe
attr_accessor :name, :servings, :ingredients, :instructions
def initialize(name, servings=1, &block)
self.name = name
self.servings = servings
self.ingredients = []
self.instructions = []
instance_eval &block
@poteto
poteto / webdev-tools.md
Created October 15, 2012 03:46
Web tools directory
@poteto
poteto / gist:3903885
Created October 17, 2012 05:41
subtle background glow
#content {
width: 800px;
margin: auto;
padding: 100px;
padding-bottom: 60px;
background: -moz-radial-gradient(center,ellipse cover,rgba(255, 255, 255, 0.5) 0,rgba(255, 255, 255, 0) 70%);
background: -webkit-gradient(radial,center center,0px,center center,100%,color-stop(0%,rgba(255, 255, 255, 0.5)),color-stop(70%,rgba(255, 255, 255, 0)));
background: -webkit-radial-gradient(center,ellipse cover,rgba(255, 255, 255, 0.5) 0,rgba(255, 255, 255, 0) 70%);
background: -o-radial-gradient(center,ellipse cover,rgba(255, 255, 255, 0.5) 0,rgba(255, 255, 255, 0) 70%);
background: -ms-radial-gradient(center,ellipse cover,rgba(255, 255, 255, 0.5) 0,rgba(255, 255, 255, 0) 70%);
@poteto
poteto / _media_queries.sass
Created October 22, 2012 13:54
Sass media queries
// Standard device screen widths
$iphone-portrait: 320px
$iphone-landscape: 480px
$ipad-portrait: 767px
$ipad-landscape: 980px
$desktop: 1224px
$desktop-large: 1824px
// General device targeting
// Use: Only use if you want the style to apply to many devices