Skip to content

Instantly share code, notes, and snippets.

View jfarmer's full-sized avatar
🐢

Jesse Farmer jfarmer

🐢
View GitHub Profile
@jfarmer
jfarmer / fib_bench.rb
Created February 5, 2015 18:43
Fibonacci!
require "benchmark"
# Basic iterative version
def fib_iterative(n)
return 0 if n == 0
return 1 if n == 1
fibs = [0,1]
2.upto(n) do |i|
# Method name: item_counts
# Input: An arbitrary array
#
# Returns: A hash where every item is a key whose value is the number of times
# that item appears in the array
#
# Prints: Nothing
# Version 0.1
# ====================================================
SELECT p.*
FROM projects AS p
JOIN genres_projects AS gp
ON (gp.project_id = p.id)
JOIN genres AS g
ON (gp.genre_id = g.id)
WHERE g.name IN ('Drama', 'Comedy')
GROUP BY p.id
@jfarmer
jfarmer / rot_n_jesse.rb
Last active August 29, 2015 14:05 — forked from Katzy/ROTN
def rot_n_char(char, rot_by)
fail ArgumentError, "First argument must be a 1-letter String (got `#{char}')" unless char.length == 1
case char
when ('a'..'z')
((char.ord - 'a'.ord + rot_by) % 26 + 'a'.ord).chr
when ('A'..'Z')
((char.ord - 'A'.ord + rot_by) % 26 + 'A'.ord).chr
else
char
def textalyzer (string)
file_name = ARGV[0]
string = open(file_name).read
histogram(freq(count(str_char(sanitize(string)))))
return
end
def count (string)

Jesse's Notes

I carry around a little notebook with me all the time. When I'm teaching or meeting with someone I use it as my "extended working memory." I don't save the notebooks or revisit them. Once a notebook is filled I simply throw it away.

Well, with on exception: when I left DBC, I flipped through my most recent notebook, tore out any pages that grabbed my attention, and threw the rest away. These are those notes.

@jfarmer
jfarmer / LICENSE
Last active August 29, 2015 14:01
A very simple REPL. Copyright 2014 CodeUnion, Inc.
Copyright (C) 2014 CodeUnion, Inc. (http://codeunion.io)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all

Questions

How do I get it to return per line, isn't that the point of this exercise? For instance, how would I get it to return each value, such as line 35's list "total = 0" on one line, next "total = 0 + 11", next line "total = 11+22".

I could not find a way to do it like, 'running_total = return item[0], return item[0] + item[1]...item[i]'.

First, it's good that you understand what you need to do and are referring to the last item of the list as item[i]. Keep in mind that if the list is in the variable list then to get the item at, say, index 10, we want list[10], not item[10]. Imagine if you could write code like this:

def sum(list)

An Excerpt From William James' Pragmatism

See http://www.authorama.com/pragmatism-2.html

The history of philosophy is to a great extent that of a certain clash of human temperaments. Undignified as such a treatment may seem to some of my colleagues, I shall have to take account of this clash and explain a good many of the divergencies of philosophers by it. Of whatever temperament a professional philosopher is, he tries when philosophizing to sink the fact of his temperament. Temperament is no conventionally recognized reason, so he urges impersonal reasons only for his conclusions. Yet his temperament really gives him a stronger bias than any of his more strictly objective premises. It loads the evidence for him one way or the other, making for a more sentimental or a more hard-hearted view of the universe, just as this fact or that principle would. He trusts his temperament. Wanting a universe that suits it, he believes in any representation of the universe that does suit it. He feels men of o

There is an image of a school growing up in my mind all the time; a school where some actual and literal constructive activity shall be the centre and source of the whole thing, and from which the work should always be growing out in two directions — one the social bearings of that constructive industry, the other the contact with nature which supplies it with its materials.

— John Dewey to Alice Chipman Dewey and children, November 1st, 1894, John Dewey Papers

I stumbled across this quote while reading The Metaphysical Club, a fantastic book about the birth and evolution of the Pragmatic tradition in the United States. What struck me most was that it an almost perfect reflection of how I thought about our work at Dev Bootcamp.

One of the most common questions about Dev Bootcamp I got from students, press, and other entrepreneurs is somethi