- Have a breakable toy side Rails project. It anchors your learning. Apply new skills/techniques here.
- Put the code in Github. Give mentors access to the project. They'll review your code.
- Understand the code review process and other style guidelines.
- Deploy your breakable toy to Heroku.
- Set learning goals weekly (e.g. X chapters of the Pickaxe, X Railscasts/week).
- Keep a text document (using vim) to record interesting commands/concepts/things you've learned.
- Review the text document daily for comprehension.
This file contains hidden or 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 Admin | |
| def admin(&block) | |
| @admin ||= Admin.new(&block) | |
| end | |
| class << self | |
| attr_accessor :name, :environment # class attributes | |
| def new | |
| unless @instance # Singleton-pattern only one instance | |
| yield(self) # Yielding self, so self is Admin | |
| end |
This file contains hidden or 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
| def m1 &block | |
| m2 &block | |
| end | |
| def m2 | |
| yield | |
| end | |
| m1 {puts "hello"} # hello |
This file contains hidden or 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
| def method_with_block_as_closure(&block) | |
| another_method block | |
| end | |
| def another_method(variable) | |
| m2 &variable | |
| end | |
| def m2 | |
| x=25 | |
| yield x |
This file contains hidden or 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 Translator | |
| def speak &language # Proc.new { |obj| obj.send(:method) } | |
| language.call(self) # self make obj so it convert to self.send(:method) | |
| # Proc.new { |obj| obj.send(method) } .call(self) | |
| end | |
| protected | |
| def french | |
| 'bon jour' |
This file contains hidden or 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 Excel | |
| module Formulas | |
| def pmt(rate, nper, pv, fv=0, type=0) | |
| ((-pv * pvif(rate, nper) - fv ) / ((1.0 + rate * type) * fvifa(rate, nper))) | |
| end | |
| def ipmt(rate, per, nper, pv, fv=0, type=0) | |
| p = pmt(rate, nper, pv, fv, 0); | |
| ip = -(pv * pow1p(rate, per - 1) * rate + p * pow1pm1(rate, per - 1)) | |
| (type == 0) ? ip : ip / (1 + rate) |
This file contains hidden or 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
| # Clone rbenv into ~/.rbenv | |
| git clone git@github.com:sstephenson/rbenv.git ~/.rbenv | |
| # Add rbenv to your PATH | |
| # NOTE: rbenv is *NOT* compatible with rvm, so you'll need to | |
| # remove rvm from your profile if it's present. (This is because | |
| # rvm overrides the `gem` command.) | |
| echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"' >> ~/.bash_profile | |
| exec $SHELL |
This file contains hidden or 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
| Список изученного: | |
| Ruby | |
| 1. "Язык программирования Ruby" Дэвид Флэнаган, Юкихиро Мацумото | |
| 2. "Изучаем Ruby" Майкл Фитцджеральд | |
| 3. "Учись программировать" Крис Пайн | |
| 4. Ruby в Викиучебнике (сейчас вроде как удалили) | |
| 5. Скринкасты ruby.hasbrains.ru (Роман Снитко) | |
| 6. Курсы Codeschool (Try Ruby, Ruby Bits, Ruby Bits Part 2) | |
| 7. Другие он-лайн курсы (RubyMonk, RubyKoans) |
Hello Class!
This is a Gist, a pastable area on the web that I'll be using to save code snippets off, so you can copy and paste from here, and don't have to worry about missing some things I type.
Slide presentation (while in class): http://192.168.1.84:9090/
Ruby Documentation:
Personal Development
The Passionate Programmer
Ruby
The Ruby Programming Language - David Flanagan, Yukihiro Matsumoto
Programming Ruby 1.9 - Dave Thomas, Chad Fowler, Andy Hunt