Skip to content

Instantly share code, notes, and snippets.

View jfarmer's full-sized avatar
🐢

Jesse Farmer jfarmer

🐢
View GitHub Profile
@jfarmer
jfarmer / 00 - Table of Contents.md
Last active December 16, 2015 03:18
Copyright © Dev Bootcamp. All rights reservered. Don't repurpose any of this without permission from Dev Bootcamp. Yadda yadda.

Table of Contents

All content herein Copyright © Dev Bootcamp. All rights reservered. Don't repurpose any of this without permission from Dev Bootcamp. Yadda yadda.

Required Reading!!

The Meat of the Day

class GuessingGame
def initialize(answer)
@answer = answer
end
def guess(g)
if @answer < g
return :high
@jfarmer
jfarmer / theory_of_learning.md
Last active May 6, 2023 22:55
Dev Bootcamp's Theory of Learning

How Dev Bootcamp Teaches: ActiveRecord

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.

Dev Bootcamp's Theory of Learning

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

@jfarmer
jfarmer / README.md
Last active August 25, 2023 14:10
Sudoku solver in Ruby that uses recursive backtracking, with benchmark code + 200 unsolved puzzles

Ruby Sudoku

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
@jfarmer
jfarmer / students.txt
Created May 17, 2012 23:31
A table of students
+----+------------+-----------+--------+------------+---------------------------------+-----------------------+
| id | first_name | last_name | gender | birthday | email | phone |
+----+------------+-----------+--------+------------+---------------------------------+-----------------------+
| 1 | Nikolas | Friesen | female | 1998-12-24 | [email protected] | 449.897.7415 |
| 2 | Randi | Halvorson | male | 1997-01-29 | [email protected] | (697)436-2633 |
| 3 | Sally | Buckridge | male | 1997-10-30 | [email protected] | 1-351-672-6358 x02502 |
| 4 | Morris | Swift | male | 1995-06-27 | [email protected] | (600)142-5639 x9380 |
| 5 | Sidney | Ortiz | male | 1997-04-04 | [email protected] | 554.170.3265 |
| 6 | Reid | Skiles | male | 1994-10-13 | [email protected] | (543)511-2123 |
| 7 | Violet
@jfarmer
jfarmer / todo.txt
Created May 17, 2012 23:30
A rudimentary "database" for a TODO app
(2012-05-01 15:43) [ ] This is a todo item created on May 1st, 2012 at 3:43PM
(2012-05-02 09:10) [X] This is a completed todo item created on May 2nd, 2012 at 9:10AM
(2012-05-03 10:00) [X] Buy groceries
(2012-01-01 00:01) [ ] Make better New Years' resolutions
@jfarmer
jfarmer / 01-truthy-and-falsey-ruby.md
Last active March 5, 2025 10:26
True and False vs. "Truthy" and "Falsey" (or "Falsy") in Ruby, Python, and JavaScript

true and false vs. "truthy" and "falsey" (or "falsy") in Ruby, Python, and JavaScript

Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).

This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.

If you want to use or share this material, please see the license file, below.

Update

@jfarmer
jfarmer / eigenclass.rb
Created May 6, 2012 23:59
Eigenclasses in Ruby
# In Ruby everything is an object, including classes.
# That means class methods are instance methods of some object.
# But what object?
class Object
def eigenclass
class << self
self
end
end
@jfarmer
jfarmer / gist:1548762
Created January 2, 2012 00:19
Get the battery life percentage of your bluetooth mouse on Mac OS X
ioreg -n "BNBMouseDevice" | grep -i "batterypercent" | sed 's/[^0-9]//g'
@jfarmer
jfarmer / gist:1515311
Created December 23, 2011 20:42
cd out of /private on OS X
# Get rid of /private ugh
if [[ $PWD =~ ^/private ]];then
cd ${PWD#*/private}
fi