Skip to content

Instantly share code, notes, and snippets.

View briankung's full-sized avatar

Brian Kung briankung

  • Chicago
View GitHub Profile
@briankung
briankung / The Pragmatic Programmer Chapter 4: Pragmatic Paranoia.md
Last active March 8, 2023 22:31
The Pragmatic Programmer Chapter 4: Pragmatic Paranoia

Pragmatic Paranoia

This chapter is about defensive coding practices, both against users of your software and against yourself. Pragmatic Programmers, after all, understand that everyone makes mistakes, even themselves.

Design by Contract

This confused the shit out of me. I wasn't entirely sure what the difference was between a contract and a unit test.

Contracts are introduced in the context of employment contracts. That is, before any work is done, the responsibilities of both parties are defined, as well as the consequences of failing. Contracts in programming are similar. As I mentioned before, I wasn't able to make a strong distinction between contracts and unit tests (given some condition, when some event, then this should happen, though I may be confusing this with [BDD][bdd]). It's all a bit jumbled in my head.

@briankung
briankung / The Pragmatic Programmer Chapter 5: Bend, or Break.md
Last active December 29, 2015 10:59
The Pragmatic Programmer Chapter 5: Bend, or Break

Bend, or Break

Chapter 5, Bend, or Break, is about writing flexible code, or code that can be changed easily in order to keep up with changing demands, or even just for the purposes of maintainability.

Decoupling and the Law of Demeter

"Organize your code into cells (modules) and limit the interaction between them. If one module then gets compromised and has to be replaced, the other modules should be able to carry on."

- The Pragmatic Programmer, p138

@briankung
briankung / Learning Object Oriented Python.md
Last active September 7, 2023 13:24
Learning Object Oriented Python

Learning Object Oriented Python

I wrote this as a guide for a financial analyst friend of mine looking to learn Python. He is already fairly well versed in doing Project Euler problems in Ruby. All italicized text is for the benefit of any other readers, such as yourself.

Each section is divided into a short resource (10 minutes or less), a long resource (days to weeks or more), and a challenge.

~

So what you're looking to do is to be able to recreate financial models in code. And other types of models. This is a noble pursuit.

@briankung
briankung / The Project Euler Sprint Rules.md
Last active December 14, 2017 02:20
The Project Euler Sprint Rules

The Project Euler Sprint Hack Nights

Project Euler Sprint Hack Nights are beginner friendly events where you can work on your own projects or engage in a friendly competition called the Project Euler Sprint.

The Project Euler Sprint is a friendly competition involving solving Project Euler ([http://projecteuler.net][projecteuler]) problems for points. Project Euler is a series of increasingly difficult computational math problems that must be solved with code (generally speaking - we've had some impressive solutions in pen and paper as well as on an Excel spreadsheet).

Each problem is harder than the last, so each problem is worth its problem number in points. Problem #1 is easy, so it's worth 1 point, while problem #50 is much harder, but worth 50 points. You can form teams of 4 people and solutions can be in any language as long as it's coded there. More detailed rules below.

Sprint Rules

@briankung
briankung / SYWtLtP.md
Last active August 29, 2015 13:55
So You Want to Learn to Program?

So you want to learn to program?

My name is Brian Kung. I'm a developer, mostly self-taught, and I'm extremely passionate about helping people learn to program. Throughout high school and college, I avoided programming because I thought I wasn't smart enough for it, or because I thought it was the same thing as my high school job, fixing computers (Information Technology), which I hated. It wasn't until I graduated from college that I discovered that I had the capability to learn programming.� Within a year of deciding to learn to program, I had landed a job at the Chicago Sun-Times as a Ruby on Rails web developer.

I'm not going to assume that you want to program professionally. Maybe you just need it for one project. Or maybe you just needed in order to be able to communicate with people more technical than yourself. Whatever it is you need to learn programming for, it's helpful to know the lay of the land, which is what I'm here for. As someone relatively new to the field of programming, I know what it

@briankung
briankung / The Summarized Pragmatic Programmer.md
Last active December 12, 2017 08:12
The Summarized Pragmatic Programmer

The Summarized Pragmatic Programmer

When I first started reading The Pragmatic Programmer, I summarized every chapter after I read it. I eventually stopped summarizing and just finished reading the book, but I intend on finishing the job. Writing the summaries greatly improved my comprehension of each chapter.

Chapters

  1. [A Pragmatic Philosophy][1]
  2. [A Pragmatic Approach][2]
  3. [The Basic Tools][3]
  4. [Pragmatic Paranoia][4]
@briankung
briankung / 0_CASH Music Chicago Summit.md
Last active August 29, 2015 13:56
CASH Music Chicago Summit

CASH Music Chicago Summit

CASH Music is a nonprofit empowering musicians towards a sustainable future.

What follows are a series of highly paraphrased or partially quoted talks. I am by no means a professional stenographer. These are not the speakers' own words!

The 2014 summits will be more ambitious in scale. Each summit will be a two-day event with an invite-only discussion day and a public workshop day that will feature industry experts from both music and tech.

We'll film talks from the discussion days, write deeper analysis, and use the events to learn and grow. Part hack day and part industry education, the workshop days will give musicians and technologists a place to learn, build new things, and test new ideas.

@briankung
briankung / ProjectEuler5kDescription.md
Last active August 29, 2015 14:02
Project Euler 5k Description

The Project Euler 5k is a friendly, team-based competition happening on Saturday, June 28th, 2014 at ThoughtWorks (200 E Randolph St Chicago, IL 60601 - map) involving problems from projecteuler.net. Anyone, from beginners to experienced practitioners, are welcome to join.

Your team of four is given 3 hours to solve as many of the problems as you can. The team that comes out with the most points wins their division, which are decided by the difficulty of the problems they solve. Simple!

11am - Doors open
12pm - Lunch
1pm - 4:00pm - Sprints E, I, and Pi begin
4:00pm - Wrap up, winners and prizes announced

filename = "test_cases.txt"
instructions = InstructionReader.new(filename)
# Returns the number of instructions, or how many rovers are given directions
instructions.count
#=> 2
instructions[0].initial_coordinates
#=> [1,2]
@briankung
briankung / strongFemaleProtagonistNavigation.js
Last active August 29, 2015 14:15
Keypress Navigation for Strong Female Protagonist
// ==UserScript==
// @name Strong Female Protagonist Navigator and Alt Text Reader
// @namespace https://gist.github.com/briankung/092efc3a10e1f712752c
// @version 0.0.7
// @description This lets you navigate the webcomic with the arrow keys. It will show you the mouseover text
// from the current comic before loading the next one unless you hold shift.
// @author Brian Kung
// @match http://strongfemaleprotagonist.com/*
// @grant none
// ==/UserScript==