Get it from the App Store.
In XCode's Preferences > Downloads you can install command line tools.
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |
by Jonathan Rochkind, http://bibwild.wordpress.com
Capistrano automates pushing out a new version of your application to a deployment location.
I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".
# Place in config/initializers/ | |
Rails.application.assets.logger = Logger.new('/dev/null') | |
Rails::Rack::Logger.class_eval do | |
def call_with_quiet_assets(env) | |
previous_level = Rails.logger.level | |
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0 | |
call_without_quiet_assets(env).tap do | |
Rails.logger.level = previous_level | |
end |
#!/bin/bash | |
# License: Public Domain. | |
# Author: Joseph Wecker, 2012 | |
# | |
# -- DEPRICATED -- | |
# This gist is slow and is missing .bashrc_once | |
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch | |
# (Thanks gioele) | |
# | |
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile? |
sudo add-apt-repository ppa:pitti/postgresql | |
sudo apt-get update | |
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2 | |
sudo su -l postgres | |
psql -d template1 -p 5433 | |
CREATE EXTENSION IF NOT EXISTS hstore; | |
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | |
service postgresql stop | |
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf" |
There are many (old) clients available:
The Google Analytics API is at v3 (at time of writing).
This example uses Google's Ruby API client to access Analytics. Use https://github.com/google/google-api-ruby-client (Google supported).
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \; |
require 'rubygems' | |
require 'faraday' | |
require 'socksify' | |
require 'socksify/http' | |
require 'awesome_print' | |
# This is a SOCKS monkey patch for Faraday, with example use/unit test. | |
# Notes: | |
# * It is altered to work with SOCKS5 authentication. | |
# * net_http_class must return a Faraday::Adapter::NetHttp instance. |