Event: Central PA Open Source Conference - http://cposc.org/ - October 27th, 2012
Speaker:
Scott Woods
West Arete
scott@westarete.com
http://twitter.com/westarete
| require 'bundler/setup' | |
| require 'active_support' | |
| require 'active_support/dependencies' | |
| ActiveSupport::Dependencies.autoload_paths += %w{ app/models lib } | |
| require 'active_record' | |
| db_config = YAML.load_file('config/database.yml') | |
| ActiveRecord::Base.establish_connection(db_config['test']) |
| screen_name | full_name | number_of_tweets | |
| -----------------+----------------------+------------------ | |
| TheStateTheatre | The State Theatre | 1468 | |
| discoveryspace | Discovery Space | 1463 | |
| CentreCoPAWS | Centre County PAWS | 618 | |
| CentreFNDN | Centre Foundation | 292 | |
| ccwrcedteam | CCWRC | 250 | |
| AllaynB | Allayn Beck | 157 | |
| TheHouseofCare | The House of Care | 156 | |
| olliatpsu | OLLI at Penn State | 147 |
| require 'component/component_spec_helper' | |
| describe "Routing", type: :routing do | |
| describe "for the home page" do | |
| specify {{ get: '/' }.should route_to('lists#index') } | |
| end | |
| describe "for authentication" do | |
| specify {{ get: '/auth/new' }.should route_to('sessions#new') } | |
| specify {{ get: '/auth/37signals/callback' }.should route_to('sessions#create', provider: '37signals') } | |
| specify {{ get: '/auth/failure' }.should route_to('sessions#failure') } |
| #!/opt/ruby/bin/ruby | |
| # This script will clean out old capistrano releases from a set of | |
| # subdirectories, but will keep a minimum number. It's designed to be run as | |
| # a cron job. | |
| # | |
| # (c) Copyright 2008 West Arete Computing, Inc. | |
| require 'thread' | |
| require 'fileutils' |
Event: Central PA Open Source Conference - http://cposc.org/ - October 27th, 2012
Speaker:
Scott Woods
West Arete
scott@westarete.com
http://twitter.com/westarete
| #!/bin/bash | |
| # | |
| # Scott Woods's custom bash prompt. | |
| # | |
| # Load this file by adding the following to the bottom of your ~/.bashrc: | |
| # | |
| # function prompt_command { | |
| # export PS1=$(~/.prompt.bash) | |
| # } | |
| # export PROMPT_COMMAND='export LAST_RETURN_VALUE=$? ; prompt_command' |
| #!/bin/bash | |
| # | |
| # Enable TRIM support for 3rd Party SSDs. Works for Mountain Lion | |
| # | |
| # Source: http://digitaldj.net/2011/07/21/trim-enabler-for-lion/ | |
| set -e | |
| set -x | |
| # Back up the file we're patching |
| sql = %{ | |
| select enumlabel | |
| from pg_enum | |
| where enumtypid = 'company_status'::regtype | |
| order by oid | |
| } | |
| result = ActiveRecord::Base.connection.execute(sql) | |
| result.each do |row| |
| class A | |
| @counter = 0 | |
| def self.inc | |
| @counter += 1 | |
| end | |
| end |
| #!/bin/bash | |
| set -e # Exit on error | |
| set -x # Print each command | |
| # Set up the OpsCode repository | |
| echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | tee /etc/apt/sources.list.d/opscode.list | |
| gpg --keyserver keys.gnupg.net --recv-keys 83EF826A | |
| gpg --export packages@opscode.com | tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg | |
| apt-get update |