sudo /etc/init.d/nginx start ... sudo /etc/init.d/nginx stop ... sudo /etc/init.d/nginx restart
Rails Snippets
A collection of rails code snippets that I'm finding useful and want to commit somewhere.
Friday, August 8, 2014
Start Nginx on Rackspace
Monday, February 3, 2014
Git Auto Completion
Make sure you have brew.
brew install git bash-completion
Edit your bash_profile...
vim ~/.bash_profile
...and add this:
Save and restart your terminal or run source to make sure it works.
source ~/.bash_profile
Experience the bliss that is git autocompletion.
ActiveRecord::StatementInvalid: SQLite3::BusyException: database is locked:
rails c
and running
ActiveRecord::Base.connection.execute("BEGIN TRANSACTION; END;")
rake db:test:prepare
Friday, January 31, 2014
Rails Destroy Table, Create Table, Migrate
Wednesday, January 29, 2014
Rails: A server is already running. Check /vagrant/tmp/pids/server.pid
vagrant@precise32:/vagrant$ rails s
=> Booting Thin
=> Rails 3.2.16 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
A server is already running. Check /vagrant/tmp/pids/server.pid
$ lsof -wni tcp:3000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ruby 12365 vagrant 9u IPv4 114859 0t0 TCP *:3000 (LISTEN)
kill -9 12365
Tuesday, December 31, 2013
Code Test
Code Snippets
I’m testing out StackEdit as a blog writing tool. Hopefully this shows some code snippets.
Example Octopress
rake new_page["Hello World"]
rake preview
rake generate
Code block
Hello world
How are you?
Java
Object obj = new Object();
obj.getName();
Objective C
NSString *string = @"Hello World";
NSDictionary *dictionary = @{ @"title": string };
Written with StackEdit.
Monday, July 15, 2013
Command failed with status (65): [xcodebuild -project ios-sim.xcodeproj]
I'm writing a Sencha/PhoneGap app which has been a story by itself, but here's a problem that I ran into today and solved relatively quickly. I was in the process of install PhoneGap's ios-sim package with Homebrew. I ran into the following error after running brew install ios-sim
:
The following build commands failed:
Ld build/ios-sim.build/Release/ios-sim.build/Objects-normal/i386/ios-sim normal i386
Ld build/ios-sim.build/Release/ios-sim.build/Objects-normal/x86_64/ios-sim normal x86_64
(2 failures)
rake aborted!
Command failed with status (65): [xcodebuild -project ios-sim.xcodeproj -con...]
Ugh...
Turns out that xcodebuild
was pointing to XCode Developer Preview 2, which is not supported by ios-sim. Makes sense. So the solution is to change the path that xcodebuild points to. So I looked for where xcodebuild was pointing.
Jims-MacBook-Air:ios-sim jamesslien$ xcode-select -print-path
/Applications/Xcode5-DP2.app/Contents/Developer
And changed the path using the switch command
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
After that brew installed ios-sim and I'm on my way to packaging up the app for release on iPhone and Android.
Written with StackEdit.