Skip to content

Instantly share code, notes, and snippets.

View jfarmer's full-sized avatar
🐢

Jesse Farmer jfarmer

🐢
View GitHub Profile
@jfarmer
jfarmer / python-hash.md
Created August 19, 2023 15:58
Explaining Python's hash() function and __hash__ magic method

Python's hash()

Authors's Note

This is an outline of how I'd explain hash to a novice programmer. I've given versions of this explanation hundreds of times to thousands of students, beginners and experts alike.

Students tell me they find it compelling because it helps them connect w/ what's really going on by emphasizing both the technical and human/design elements.

I'm assuming the student is comfortable with:

@jfarmer
jfarmer / theory_of_learning.md
Last active April 2, 2026 08:52
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 / key.md
Created November 22, 2020 05:20
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA

@jfarmer
jfarmer / default.md
Created June 22, 2025 02:13 — forked from cablej/default.md
Cluely System prompt

<core_identity> You are an assistant called Cluely, developed and created by Cluely, whose sole purpose is to analyze and solve problems asked by the user or shown on the screen. Your responses must be specific, accurate, and actionable. </core_identity>

<general_guidelines>

  • NEVER use meta-phrases (e.g., "let me help you", "I can see that").
  • NEVER summarize unless explicitly requested.
  • NEVER provide unsolicited advice.
  • NEVER refer to "screenshot" or "image" - refer to it as "the screen" if needed.
  • ALWAYS be specific, detailed, and accurate.
@jfarmer
jfarmer / 1 - Original Post.csv
Created March 24, 2025 02:55 — forked from spdustin/1 - Original Post.csv
GSA's Non-core Properties Listing
Name City State Square Footage
11 W QUINCY COURT CHICAGO IL 106606
1202 BUILDING SEATTLE WA 181195
12021 BUILDING SEATTLE WA 0
122 W 3RD ST BUILDING GREENSBURG PA 8962
18 W. JACKSON CHICAGO IL 9506
1801 N. LYNN ST. ARLINGTON VA 364917
22ND & STOUT ST SURFACE PARKING LOT DENVER CO 0
230 S. STATE ST. CHICAGO IL 25250
2306 E. BANNISTER ROAD KANSAS CITY MO 405607
@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

And here's an argument for why you want your non-varying arguments to come first in your function signature.

Many languages have the concept of "partial application", where supplying a function with fewer arguments than it expects doesn't raise an error, but instead returns a function that is waiting for the remaining arguments.

For example, imagine if you had a function add(x,y) and add(1) didn't throw an error, but returned a function that was waiting for y and returned 1 + y when you supplied it with that single argument, e.g.,

def add(x, y):
    return x + y
@jfarmer
jfarmer / LICENSE
Created June 11, 2024 19:01
Python function to calculate the FIRST sets from a context-free grammar given in BNF
MIT License
Copyright (c) 2024 Jesse Farmer <https://github.com/jfarmer>
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:
@jfarmer
jfarmer / license.java
Created May 4, 2024 15:13 — forked from Chino-chan/license.java
Bloated code?
//Various Messages
final String boxMessage = "License Game";
final String welcomeMessage = "Welcome to License Game";
//Questions
final String question1 = "What does this mean... A: text B: text C: ";
final String question2 = "What does this mean... A: text B: text C: ";
final String question3 = "What does this mean... A: text B: text C: ";
final String question4 = "What does this mean... A: text B: text C: ";
final String question5 = "What does this mean... A: text B: text C: ";
@jfarmer
jfarmer / README.md
Last active February 15, 2024 19:23
A demonstration of the power of the command line

The Power Of The Command Line

If you all want to learn more about the command line, one thing we didn't really touch on is input/output redirection, which is ultimately what makes the command line so powerful. On the command line, you can take the output of one program and feed it as input to another program.

The power of the command line lies in its composability. The command line has general mechanisms for taking existing programs and combining them to produce new programs.

Think of this as a system-wide API that you get "for free" by using the command line. You can chain a sequence of programs together, each one feeding its output as the input to the next one in the chain, to produce a "new" program. None of the programs involved need to know they're being used in this way.

This kind of "composability" is much harder with a GUI, so programs tend to be monolithic and only interact with other programs in pre-defined, pre-sanctioned ways.