Skip to content

Instantly share code, notes, and snippets.

def add(first, second):
smooshed = ''.join(sorted(first + second, reverse=True))
smooshed = smooshed.replace('IIIII', 'V')
smooshed = smooshed.replace('VV', 'X')
smooshed = smooshed.replace('XXXXX', 'L')
return smooshed
(Chapters marked with * are already written. This gets reorganized constantly
and 10 or so written chapters that I'm on the fence about aren't listed.)
Programmer Epistemology
* Dispersed Cost vs. Reduced Cost
* Verificationist Fallacy
* Mistake Metastasis
The Overton Window
Epicycles All The Way Down
The Hyperspace Gates Were Just There
@dhh
dhh / test_induced_design_damage.rb
Last active November 2, 2024 00:52
This is an extraction from Jim Weirich's "Decoupling from Rails" talk, which explained how to apply the hexagonal design pattern to make every layer of your application easily unit testable (without touching the database etc). It only seeks to extract a single method, the EmployeesController#create method, to illustrate the design damage that's …
# Original Rails controller and action
class EmployeesController < ApplicationController
def create
@employee = Employee.new(employee_params)
if @employee.save
redirect_to @employee, notice: "Employee #{@employee.name} created"
else
render :new
end
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@hjwp
hjwp / toggle_touchpad.py
Created November 3, 2011 14:37
Toggle touchpad on/off (python/linux)
#!/usr/bin/python2.7
import subprocess
def touchpad_currently_off():
all_states = subprocess.check_output(['synclient']).split('\n')
off_state = next((s for s in all_states if 'touchpadoff' in s.lower()), None)
return '1' in off_state
def main():
if touchpad_currently_off():