To run, clone this gist and run from the command line:
git clone https://gist.github.com/f10377abe32d7c0b01ac.git sudoku
cd sudoku
ruby sudoku.rb unsolved.200.txt
| +----+------------+-----------+--------+------------+---------------------------------+-----------------------+ | |
| | id | first_name | last_name | gender | birthday | email | phone | | |
| +----+------------+-----------+--------+------------+---------------------------------+-----------------------+ | |
| | 1 | Nikolas | Friesen | female | 1998-12-24 | agustina_braun@wintheiser.info | 449.897.7415 | | |
| | 2 | Randi | Halvorson | male | 1997-01-29 | heber.upton@bechtelarwisozk.biz | (697)436-2633 | | |
| | 3 | Sally | Buckridge | male | 1997-10-30 | nora@treutel.name | 1-351-672-6358 x02502 | | |
| | 4 | Morris | Swift | male | 1995-06-27 | cordell@sanfordkuhlman.org | (600)142-5639 x9380 | | |
| | 5 | Sidney | Ortiz | male | 1997-04-04 | erling@davis.name | 554.170.3265 | | |
| | 6 | Reid | Skiles | male | 1994-10-13 | mike_harvey@nikolaus.com | (543)511-2123 | | |
| | 7 | Violet |
I'm Jesse, one of the co-founders of Dev Bootcamp, and the acting curricular editor-in-chief. We get lots of questions about how Dev Bootcamp approaches teaching, what our curriculum is like, and how it differs from other schools and competitors. I thought I'd share some of that with you, starting with a brief overview of our theory of learning and then sharing our introduction to ActiveRecord.
This will be light on theory and heavy on ActiveRecord, so if you're not familiar with SQL or Ruby it might be hard to follow. Mea culpa.
At Dev Bootcamp, we believe that "modeling" is central to learning. The most effective students have a clear model of how the world works and are able to quickly integrate new information int
| class GuessingGame | |
| def initialize(answer) | |
| @answer = answer | |
| end | |
| def guess(g) | |
| if @answer < g | |
| return :high |
All content herein Copyright © Dev Bootcamp. All rights reservered. Don't repurpose any of this without permission from Dev Bootcamp. Yadda yadda.
| # Slightly better name, bang (!) to indicate side effects | |
| def process_raw_data! | |
| # See: | |
| # http://po-ru.com/diary/rubys-magic-underscore/ | |
| # http://po-ru.com/diary/destructuring-assignment-in-ruby/ | |
| self.raw_data.each do |date, name, url, cb_url, funding_type, value| | |
| Company.where(name: name).first_or_create(url: url, cb_url: cb_url) | |
| # See: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/Date.html#method-c-strptime | |
| Event.where(funding_type: funding_type, date: Date.strptime(date, '%M/%y'), value: value).first_or_create |
| def times_table(n) | |
| (1..n).each do |row_num| | |
| line = "" | |
| (1..n).each{ |col_num| line += "#{row_num * col_num}\t"} | |
| puts line | |
| end | |
| end | |
| times_table(5) |
| 000075400000000008080190000300001060000000034000068170204000603900000020530200000 | |
| 300000000050703008000028070700000043000000000003904105400300800100040000968000200 | |
| 302609005500730000000000900000940000000000109000057060008500006000000003019082040 | |
| 530000008007000030200006901000500200090370004000981000300040560000090000000007080 | |
| 008310900095000160000000005000400000000080049006072000000001030000240607001008200 | |
| 000400970000051600042000010030000000070508064000070000700030000300090000005864009 | |
| 060500000720000000000000320000050637000004500000230180180009000603070000004006003 | |
| 274000030000000005000600041900306000100280000006054000000000002007000583000095700 | |
| 570000069000003800090000000801600000000030600702000050000060501000702000006091032 | |
| 005200000400300700600000010800020100040800500000095000083040070090006080500902000 |
| class GuessingGame | |
| def initialize(answer) | |
| @answer = answer | |
| end | |
| def guess(guess) | |
| @last_guess = guess | |
| if guess == @answer | |
| return :correct | |
| elsif guess < @answer |
Functional JavaScript by Jesse Farmer is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Contact Jesse at jesse@20bits.com if you have any questions!