Connecting: psql -U <username> -h <host> -d <database>
- connect to database
\c database
- create database
create database <name>
- drop database
drop database <name
# ~/.tmuxinator/ks.yml | |
name: ks | |
root: ~/repos/ks-dev/kitchensurfing | |
windows: | |
- vim: vim . | |
- console: | |
- logs: | |
layout: even-horizontal |
# I want to write a method that returns the first number in a sub array where the letter matches a passed in letter | |
# If passed in letter does not exist, it should return nil | |
a = [["a", 1], ["b", 2]] | |
# Implementation | |
def get_number_for_letter(arr, letter) | |
arr.detect(Proc.new { [] }) { |d| d.first == letter }[1] | |
end | |
# Error received for case where letter does not exist | |
# This might just be me not understanding how detect is supposed to work |
# fixes mac os-x clipboad -> https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard | |
set-option -g default-command "reattach-to-user-namespace -l zsh" | |
# vi mode | |
setw -g mode-keys vi | |
unbind p | |
bind p paste-buffer | |
bind -t vi-copy v begin-selection | |
bind -t vi-copy c copy-selection |
module Router | |
class ApiConstraints | |
def initialize(options) | |
@version = options[:version] | |
@default = options[:default] | |
end | |
def default? | |
@default | |
end |
require "csv" | |
class DelimitedReader | |
def self.run(filename) | |
counter = 0 | |
CSV.foreach(filename, { :headers => true }) do |row| | |
Merchant.find(row[0]).update_attribute(:merchant_profile_id, row[1]) | |
counter += 1 |
Started POST "/items" for 127.0.0.1 at 2013-04-27 20:15:01 -0400 | |
Processing by ItemsController#create as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"d0cFp62oxV8FMYZzo1qYKPWmIwZSR+sYl8acWmsJPuw=", "item"=>{"heading"=>"hihihihi", "description"=>"adfadfasdf", "tag_list"=>"", "latlon"=>{"latitude"=>"1", "longitude"=>"2"}, "photo"=>#<ActionDispatch::Http::UploadedFile:0x007fc76b245e70 @original_filename="chillin.gif", @content_type="image/gif", @headers="Content-Disposition: form-data; name=\"item[photo]\"; filename=\"chillin.gif\"\r\nContent-Type: image/gif\r\n", @tempfile=#<File:/var/folders/mt/h7jz7dhj04n5k3mh_gkt7m300000gp/T/RackMultipart20130427-14568-11ng10z>>}, "commit"=>"Create Item"} | |
Completed 500 Internal Server Error in 0ms |