Skip to content

Instantly share code, notes, and snippets.

View jfarmer's full-sized avatar
🐢

Jesse Farmer jfarmer

🐢
View GitHub Profile
@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

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 / 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 / README.md
Last active September 8, 2023 12:07
Given a linked list and a non-negative integer k, add k to every kth element from the end of the linked list

Keybase proof

I hereby claim:

  • I am jfarmer on github.
  • I am jfarmer (https://keybase.io/jfarmer) on keybase.
  • I have a public key ASCxNmuHrckOs4s9PC96DGZLqh98V1LsYzD5ysU3uVO_Awo

To claim this, I am signing this object:

@jfarmer
jfarmer / nyt_homepage_.yesterday.sh
Last active December 5, 2020 21:12
Create PNG of yesterday's NYTimes homepage
# The -1d in the date command means yesterday, so, e.g., -2d would be two days ago
# Change the output file extension if you want another image type
# "-resize 1440x" resizes to 1440px wide while preserving aspect ratio
curl "https://static01.nyt.com/images/$(date -v -1d +"%Y/%m/%d")/nytfrontpage/scan.pdf" | convert -density 600x600 -antialias - -resize 1440x -quality 100 "output_file_name.png" nyt_homepage_yesterday.png
@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

Scavenger Hunt

Every item below refers to a specific function built into the JavaScript language. For each item, find:

  1. The relevant page and section on MDN's official JavaScript documentation
  2. At least one online resource (tutorial, etc.) other than Stack Overflow, w3cshools, or geekforgeeks explaining the function

Scavenger Items

  1. Given two numbers, tell me how to get the remainder after dividing the former by the latter.