The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rails development environment talk
1. My Ruby (and Rails)
environment
Reuven M. Lerner • reuven@lerner.co.il
Rails Underground, Israel • July 13th, 2011
2. Who am I?
• Web developer, software architect,
consultant, lecturer/trainer
• Linux Journal columnist since 1996
• Mostly Ruby on Rails + PostgreSQL, but
also Python, PHP, jQuery, and lots more...
3. Want to learn Rails?
• I’m teaching a course at Hi-Tech College
• Not very far from here!
• August 14 - 18 , 2011
th th
• (I can do private training as well...)
4. Also:
• I’m swamped with Ruby work!
• Want to help me out?
• (I need to sleep!)
• Come speak with me after my talk...
6. Shell
• For years, I used bash
• GNU Bourne-Again Shell
• I recently switched to zsh
• I use the plugin, “oh my zsh”
• Did it change my life? No.
• But some things are easier
7. Better things
• Easy-to-customize prompt
• Saner history (across terminal tabs)
• Automatic updates of oh-my-zsh
• One configuration file (.zshrc)
8. Things I use often
• C-z (suspend) and fg
• Emacs keybinding
• C-r (reverse search
• Customized prompt
9. iTerm2
• The OS X terminal is OK
• iTerm used to be much better
• Recently rewritten as iTerm2
• I use very few of the features
• Lots of tabs, though!
• My favorites: Search, movie playback
10. rvm
• Don’t develop in Ruby without rvm
• Really, it’s amazing
• I use 1.8.7, 1.9.2, and JRuby day to day
• Learn about updates!
• .rvmrc for each project I work on
• Gemsets vs. bundles — bundles are winning
11. irb
• I use irb (or the Rails console) every day
• If you’re programming in Ruby, then you
should probably have IRB open always!
• Every piece of code I write, more or less, is
tried in IRB first
• Debugging largely happens for me in IRB
12. Gems for IRB!
• There has been an explosion of IRB-
enhancing gems
• I’ll present some of them
• Most or all of these are from the “irbtools”
gem, which packages them together
16. ;nil after long evals
• Cute trick: If you’re reading a lot of data, add
;nil
• to the end of your command, so that IRB
won’t print it all.
17. hirb
• Shows data in a table
• Sort of like ap, but for to_s
• Better with ActiveRecord output
• If you want to disable it (I do by default),
just set Hirb::View.disable, or
Hirb::View.enable
20. GNU Emacs
• One True Editor
• I’ve used it since 1988 (yes, 1988!)
• More operating system than editor
• Configure it in Emacs Lisp
• Full, Turing-complete language with
oodles of functions for text, files,
networks, and psychoanalysis
22. Required anti-vi joke
Subject: Re: HELP: music for cl, vi, vlc, pi
Date: 14 May 1996 10:35:43 +0200
Alan> vi doesn't play music.
David> Sure it does.
In fact, vi has a special mode just for music. If you
are not in insert mode, you are in `beep' mode:
whatever you press produces a beep. In the best
tradition of vi, there is of course just one note
(you know: small is beautiful) but this is just one
of those reasons why vi hackers love vi.
30. Snippets
• TextMate fans, rejoice — Emacs has
snippets, too!
• It has had “abbrevs” forever
• Even import TextMate snippets
• I don’t use these that much, to be honest
31. Intellisense?
• Everyone in Israel asks about it!
• Emacs has a few options that come close
• I’ve used it on a few occasions, but never
really liked it
32. Flymake
• Check your syntax (with a background
Ruby process) as you type!
• Errors? The line appears in red
33. Ruby electric mode
• Inserts extra quotes, braces,
• Also inserts “end” after class, module, if,
etc.
34. Rainbow delimiters
• Fancy braces!
• Each set of parens/braces gets its own
color
• Lovely when you have a hash
35. Rinari
• Rinari Is Not A Rails IDE
• Keyboard shortcuts to jump to related
parts of the code
• Tries to be minimal
• There’s also emacs-rails — more
functionality, but updated less frequently
36. ERb and Haml
• Handles colorizing, indenting
• Flymake works inside of ERb, also!
37. Switching buffers
• From controllers (C-c ‘ f c) — functional
tests (C-c ‘ f t)
• Models (C-c ‘ f m) — unit tests (or C-c ‘ f t)
• Switch to the log (C-c ‘ f o)
38. Tags
• Index of names in your files
• Jump to the right file/line
• Even search/replace
• I go back and forth on using tags ... they
work really well, but I’m often too lazy, and
end up using “git grep”
39. Emacs server
• If you’re starting Emacs more than once a
day, then you’re doing something wrong
• Open buffers
• Connect from outside
• e.g., sketch (from before, in IRB)
40. Magit
• Use Git from within Emacs!
• Stage, Commit, Stash
• Branch, Merge
• Push, pull
• Fully integrated, and works really nicely
41.
42. Macros
• Record a macro
• Replay any number of times
• Super-duper useful, especially when
converting files
43. Firefox plugins
• I use Firefox as my main browser
• Not the fastest (for now!)
• Not updated like Chrome (for now!)
• But it has excellent plugins
44. Firebug
• Everyone’s favorite JavaScript/Ajax
debugger
• Console
• Execute JavaScript
• Modify CSS in real time
• Truly an amazing piece of software
45. Web developer
• “View Generated HTML” — my favorite!
• Also:View HTTP request, response headers
• Mark items with boxes
46. Growl
• Notification system under OS X
• Autotest + Growl gives me nice output for
red/green
• Just require “autotest/growl” in your
~/.autotest file
47. Pow
• Finally, I have to run things locally
• 37signals recently released Pow for OS X
• (There’s talk of doing it for Linux, too)
• Super-duper easy:
• symlink from ~/.pow/foo to project foo
• Now go to http://foo.dev !
48. Thanks!
(Any questions?)
reuven@lerner.co.il
http://www.lerner.co.il/
054-496-8405
“reuvenlerner” on Skype/AIM