In this screencast, I demonstrate how to work with the latest Rails as well as navigate through the source.
-
Latest
Categories
- News (134)
- Note (13)
- Objective-C (2)
- Rant (129)
- Review (21)
- Screencast (42)
- Tutorial (79)
- Video (68)
-
In this screencast, I demonstrate how to work with the latest Rails as well as navigate through the source.
Try this channel. He does a fantastic job of explaining the fundamentals. The best series I’ve found for teaching new students.
YouTube Channel: http://www.youtube.com/user/AppleProgramming
Tutorial List: His Site
Better RSpec Guide from Joon You on Vimeo.
For running Rails app in development, you can do this since rails s runs on port 3000.
localhost$ ssh -R 8088:localhost:3000 remote_server -N &
This creates a tunnel that binds remote TCP port 8088 to local TCP port 3000.
-R flag is for remote binding which tell the remote server to send TCP traffic on port 8088 to my machine. This is basically reverse of -L which binds the local machine’s port to remote.
8088: specifies the port on remote server. Therefore, following command on remote server will give a result assuming that I’m running a Rails app on port 3000.
remote_server$ curl localhost:8088
localhost is the host, obviously my local machine where the traffic will bind to.
:3000 is the local port you want to bind the traffic to.
-N tells ssh to not execute a remote command. Should always use this if we’re just tunneling.
& makes it run in background.
This is the definition from socat.
Socat is a command line based utility that establishes two bidirectional byte streams and transfers data
between them
For Ubuntu, remote_server$ sudo apt-get install socat will do.
On remote server, expose a public port and then route the traffic to local port that’s bound to my local machine.
remote_server$ socat TCP-LISTEN:8090,fork,reuseaddr TCP-CONNECT:127.0.0.1:8088 &
TCP-LISTEN:8090,fork,reuseaddr tells socat to listen TCP on port 8090, creating a server at that port. The options are self-explanatory.
TCP-CONNECT:127.0.0.1:8088 tells socat to connect TCP to localhost at port 8088 which is bound to my machine.
Sick of this when you’re bundle install?
`connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
The fix:
I use RVM thanks to Wayne’s awesome response to my issue reported in IRC channel.
me$ gem update --system
me$ rvm get head
me$ rvm osx-ssl-certs update all
**UPDATE**
Forgot to include updating system gem.
Start of me playing with Ruby 2.0. Covers my installation and named parameter to start.
Ruby 2.0 – Getting Started & Named Parameters from Joon You on Vimeo.
Ok, so my desktop computer blew up. The power supply died and in the process, it screwed up my hard drive. Rather than restoring from backup, I decided to do a fresh install to clean out old crap.
To my shock, when I tried to install Homebrew, it failed miserably even though I installed Xcode and Commandline Tools. It appears that simply running
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
does not work! Instead, I get ugly
e:178: syntax error, unexpected ':', expecting $end
WTF?
Then again, it hit me that I was in fact running Ruby that came with Mac OS X. In order to install Homebrew on fresh install of Mountain Lion, here’s what you need to do:
>curl -O https://raw.github.com/mxcl/homebrew/go
>sh go
So simple, yet it’s a little gotcha that can drive you nuts.
Once you have brew, then you can install RVM and all other good stuff.