Skip to content

Instantly share code, notes, and snippets.

View treble37's full-sized avatar
🏠
Working from home

Bruce Park treble37

🏠
Working from home
View GitHub Profile
@treble37
treble37 / gist:3118765
Created July 15, 2012 21:45
Gem list for RideBum, Rails 3.2.6, 7/14/12 Sun
solved error with email_spec.rb in spec/support - https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/27
*** LOCAL GEMS ***
actionmailer (3.2.6)
actionpack (3.2.6)
activemodel (3.2.6)
activerecord (3.2.6)
activeresource (3.2.6)
activesupport (3.2.6)
@treble37
treble37 / curb
Created September 4, 2012 21:12
Trying to use curb in a ruby script....
#!/home/bruce/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
require 'rubygems'
require 'cgi'
require 'net/http'
require 'curb'
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
@treble37
treble37 / Error log
Created September 4, 2012 21:46
Webrick meets rvm meets curb
##NOTE: /myproject is my abbreviated name for /home/bruce/Desktop/github_projects/rsocialize
$ ruby wserver.rb
[2012-09-04 17:52:44] INFO WEBrick 1.3.1
[2012-09-04 17:52:44] INFO ruby 1.9.3 (2012-04-20) [i686-linux]
[2012-09-04 17:52:44] WARN TCPServer Error: Address already in use - bind(2)
[2012-09-04 17:52:44] INFO WEBrick::HTTPServer#start: pid=4430 port=3000
[2012-09-04 17:52:47] ERROR CGIHandler: /home/bruce/Desktop/github_projects/rsocialize/lib/html/ruby_cgi_post.cgi:
/home/bruce/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpservlet/cgi_runner.rb:46:in `exec': No such file or directory - /home/bruce/Desktop/github_projects/rsocialize/lib/html/ruby_cgi_post.cgi (Errno::ENOENT)
from /home/bruce/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpservlet/cgi_runner.rb:46:in `<main>'

Sublime Text 2 – Useful Shortcuts (Ubuntu)

General

Ctrl+KB toggle side bar
Ctrl+Shift+P command palette
Ctrl+` python console
Ctrl+N new file

Editing

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
@treble37
treble37 / laruby_madlibs.rb
Created May 16, 2013 05:40
Playing with mad libs in ruby....
sentence_library=["I had a ((an adjective)) sandwich for lunch today. It dripped all over my ((a body part)) and ((a noun)).",
"Our favorite language is ((gem:a gemstone)). We think ((gem)) is better than ((a gemstone))."]
#token_arr = sentence.scan(/\(\(([^)]+)\)\)/)
sentence = sentence_library[rand(sentence_library.size)]
token_arr = sentence.scan(/\(\(.*?\)\)/)
@treble37
treble37 / rails4.1beta
Created August 26, 2013 03:31
Error when running rails 4.1 beta "bundle exec rake test_postgresql"
Finished in 167.233162s, 23.0516 runs/s, 65.3339 assertions/s.
1) Error:
TimestampTest#test_bc_timestamp:
ActiveRecord::StatementInvalid: PG::DatetimeFieldOverflow: ERROR: date/time field value out of range: "0000-01-01 07:59:59.000000 BC"
: INSERT INTO "developers" ("created_at", "created_on", "name", "updated_at", "updated_on") VALUES ($1, $2, $3, $4, $5) RETURNING "id"
/home/tim/Desktop/github_projects/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:783:in `get_last_result'
/home/tim/Desktop/github_projects/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:783:in `exec_cache'
/home/tim/Desktop/github_projects/rails/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb:139:in `block in exec_query'
/home/tim/Desktop/github_projects/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:430:in `block in log'
@treble37
treble37 / Gemfile.lock and Git
Last active December 25, 2015 02:49
specifying git branch in Gemfile.lock
GIT
remote: git://github.com/milgner/compass-rails.git
revision: c86e7fd9c2605c80816a2f64a3fb8b7c3a09e494
branch: rails4
specs:
@treble37
treble37 / rails-console-tricks
Created October 14, 2013 23:24
rails console tricks
## Generating url paths
app.users_path --> app is an object, users_path is the URL helper for your User model
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)