This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Users < Application | |
# provides :xml, :yaml, :js | |
def index | |
@users = User.all | |
display @users | |
end | |
def show | |
@user = User.get(params[:id]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#crontab -l | |
8 * * * * cd ~/apps/tweetlinkmonster/current; ./update_tweets.sh > ~/cronlog.log | |
#cat apps/tweetlinkmonster/current/update_tweets.sh | |
#!/bin/sh | |
echo "about to update everyone's tweets" | |
date | |
ruby ~/apps/tweetlinkmonster/current/bin/merb -e production -r ~/apps/tweetlinkmonster/current/update_tweets.rb | |
echo "done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; This buffer is for notes you don't want to save, and for Lisp evaluation. | |
;; If you want to create a file, visit that file with C-x C-f, | |
;; then enter the text in that file's own buffer. | |
Before installing do_mysql 0.9.6 (not verbose): | |
Loading init file from /home/daniel/programming/ib/hotcards/config/init.rb | |
Loading /home/daniel/programming/ib/hotcards/config/environments/development.rb | |
~ Loaded DEVELOPMENT Environment... | |
~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** LOCAL GEMS *** | |
do_mysql (0.9.7, 0.9.6) | |
do_postgres (0.9.6) | |
do_sqlite3 (0.9.7, 0.9.6) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//"<table//"<table//"<table//"<table//"<table//"<table//"<table//"<table//"<table//"<table//"<table//"<table//"<table | |
border="1"><tr><td>hello</td><td><world></td></tr><tr><td>1</td><td>2</td></tr></table>", | |
//"Displays a <i>salutary</i> greeting to the planet.", | |
CmdUtils.CreateCommand({ | |
name: "hello-world", | |
preview: "hello", | |
execute: function() { | |
displayMessage( "Hello, World!" ); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Migrations are ugly and make you write a lot of code you don't need. | |
#in AR | |
# from http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations | |
class AddANewTable < ActiveRecord::Migration #these 3 lines | |
def self.up #are just a very verbose way to say | |
create_table :users do |table| # to make a table | |
table.column :name, :string | |
# This column will contain an MD5 hash. | |
table.column :login, :string, :null => false | |
table.column :password, :string, :limit => 32, :null => false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error TooManyFollowers do | |
halt 406, "@#{request.env['sinatra.error'].message} has more than 1000 followers!" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#rake db:migrate | |
# made a bunch of tables, ending with: | |
== AddComatoseSupport: migrating ============================================== | |
-- create_table(:comatose_pages) | |
-> 0.0323s | |
Creating the default 'Home Page'... | |
rake aborted! | |
undefined method `version=' for #<Comatose::Page:0xb6adfdfc> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#When I try to create a new user: | |
NoMethodError in AccountController#signup | |
undefined method `[]' for #<Enumerable::Enumerator:0xb6c027ac> | |
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/string/access.rb:43:in `first' | |
/home/daniel/programming/rails/solis/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:66:in `has_attachment' | |
/home/daniel/programming/rails/solis/app/models/picture.rb:20 | |
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in `load_without_new_constant_marking' | |
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in `load_file' | |
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in' | |
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:202:in `load_file' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ShortURL | |
CHARS = [*('a'..'z')] + [*('0'..'9')] | |
def next_after(string) | |
return CHARS[0] if string.empty? | |
if nex = next_char(string[-1].chr) | |
return string[0..-2] + nex | |
end | |
next_after(string[0..-2])+CHARS[0] | |
end | |
#nil if we need to increment. the next char otherwise |
OlderNewer