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
# 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) |
#!/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: |
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
/* CSS for Collapsible Blog Posts */ | |
[id^=_] { | |
display: none; | |
} |
# 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 |
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'
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 |
#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%); |
// 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 |