Skip to content

Instantly share code, notes, and snippets.

View esparkman's full-sized avatar

Evan Sparkman esparkman

View GitHub Profile
puts "What would you like the name of the new database to be?"
db_name = gets.chomp
dbh.query('CREATE DATABASE #{db_name}')
puts "#{dbh.affected_rows}"
esdezines ~/webapps/rails3/micro_twitter: bundle exec autotest
/Users/esparkman/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler.rb:215: warning: shadowing outer local variable - file
/Users/esparkman/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/shared_helpers.rb:84: warning: method redefined; discarding old gem
/Users/esparkman/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/shared_helpers.rb:81: warning: previous definition of gem was here
/Users/esparkman/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/shared_helpers.rb:116: warning: method redefined; discarding old from_gems_in
/Users/esparkman/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/source_index.rb:75: warning: previous definition of from_gems_in was here
/Users/esparkman/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/shared_helpers.rb:125: warning: method redefined; discarding old refresh
/Users/esparkman/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:728: warning: previous definition of refresh was
~ > cat foo.rb
#!/usr/bin/env ruby
loop do
puts "whatcha wanna do"
answer = gets.chomp
case answer
when '1'
class PeopleController < ApplicationController
# GET /people
# GET /people.xml
def index
@people = Person.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @people }
end
<h1>Employee Queue</h1>
<%= form_tag client_people_path(@client), :method => :get do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
</p>
<% end %>
<div class="logs">
INSERT INTO `clients` (`id`,`name`,`location`,`email`,`phone_number`,`alt_phone_number`,`created_at`,`updated_at`)
VALUES
(1, 'Via Christi', 'Kansas', '', '', '', '2010-09-30 20:20:38', '2010-09-30 20:20:38'),
(2, 'Arvest', '', '', '', '', '2010-09-30 20:22:32', '2010-09-30 20:22:32'),
(3, 'Cumber County Schools', 'Fayetteville, NC', '', '', '', '2010-09-30 20:22:53', '2010-09-30 20:22:53');
<%= form_for([@client, @person]) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :first_name %><br />
<%= f.text_field :first_name %>
</p>
<p>
<%= f.label :last_name %><br />
<%= f.text_field :last_name %>
</p>
ruby-1.9.2-p0 > Stumie.api_key=['ee00ed350eb93e3d371f3592ad71d4c3']
=> ["ee00ed350eb93e3d371f3592ad71d4c3"]
ruby-1.9.2-p0 > profile = Stumie.pull
ArgumentError: wrong number of arguments (0 for 1)
from /Users/esparkman/.rvm/gems/ruby-1.9.2-p0@rails3/gems/stumie-0.1.0/lib/stumie.rb:13:in `pull'
from (irb):2
from /Users/esparkman/.rvm/gems/ruby-1.9.2-p0@rails3/gems/railties-3.0.1/lib/rails/commands/console.rb:44:in `start'
from /Users/esparkman/.rvm/gems/ruby-1.9.2-p0@rails3/gems/railties-3.0.1/lib/rails/commands/console.rb:8:in `start'
from /Users/esparkman/.rvm/gems/ruby-1.9.2-p0@rails3/gems/railties-3.0.1/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_apps, OpenID::Store::Filesystem.new('/tmp'), :domain => 'starrobbins.com'
end
def create
omniauth = request.env["omniauth.auth"]
authentication = Authentication.find_by_provider(omniauth['provider'], omniauth['uid'])
if authentication
flash[:notice] = "Signed in successfully."
sign_in_and_redirect(:user, authentication.user)
elsif current_user
current_user.authentications.create!(:provider => omniauth['provider'], :uid => omniauth['uid'])
flash[:notice] = "Authentication successful."
redirect_to authentications_url