Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Taylor Hodge jthodge

🎯
Focusing
View GitHub Profile
View thunk-example.ts
type Sum = (x: number, y: number) => number;
export function CreateSum(): Sum {
return function(x: number, y: number): number {
return x + y;
};
}
@jthodge
jthodge / latency.markdown
Created Dec 21, 2019 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

View standby-hibernate-delay-tweak.sh
#!/bin/bash
# Set standby delay on battery to 12hr
sudo pmset -b standbydelay 43200
# Disable it entirely on battery
sudo pmset -c standby 0
# Disable hibernation
sudo pmset -a hibernatemode 0
View stateful-regex-objects.js
let re = /a/g
re.test('ab') // returns true
re.test('ab') // this will fail! re.lastIndex === 1 so it starts searching at 'b'
re.test('ab') // this will pass! since it failed, re.lastIndex is reset to 0
// https://stackoverflow.com/questions/11477415/why-does-javascripts-regex-exec-not-always-return-the-same-value
@jthodge
jthodge / fix-emacs-permissions-catalina.el
Created Apr 12, 2020 — forked from dive/fix-emacs-permissions-catalina.el
Fix Emacs permissions on macOS Catalina
View fix-emacs-permissions-catalina.el
;;; package --- Fix permissions for Emacs.app on macOS Catalina
;;; Author: Artem Loenko
;;; Mail-To: <artyom.loenko@mac.com>
;;; Commentary:
;;; Code:
(defconst _default-emacs-app-plist-path "/Applications/Emacs.app/Contents/Info.plist")
(defconst _temp-buffer-name "*fixing Emacs permissions*")
(defconst _temp-buffer (get-buffer-create _temp-buffer-name))
(with-current-buffer _temp-buffer (erase-buffer))
View View Graphile Worker Queue in Local Dev
pgcli -h localhost -u postgres -d api_development
select * from graphile_worker.jobs
@jthodge
jthodge / markup.rkt
Created Sep 11, 2020
ask professor markup
View markup.rkt
(define (ask-professor . elements)
`(div ((id "askme"))
(h4 "Ask Professor Markup")
(div ((class "inner"))
(blockquote
,@elements
)
)
))
@jthodge
jthodge / unfollow.js
Created Sep 20, 2020 — forked from JamieMason/unfollow.js
Unfollow everyone on twitter.com
View unfollow.js
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/7580315
//
// 1. Go to https://twitter.com/YOUR_USER_NAME/following
// 2. Open the Developer Console. (COMMAND+ALT+I on Mac)
// 3. Paste this into the Developer Console and run it
//
// Last Updated: 09 April 2020
(() => {
const $followButtons = '[data-testid$="-unfollow"]';
@jthodge
jthodge / stats.sh
Created Jul 19, 2021
Script for iterating over git revisions and computing statistics for each
View stats.sh
#!/bin/bash
set -e
file_pattern=$1
function main {
for rev in `revisions`; do
echo "`number_of_lines` `commit_description`"
done
View 20111011_SteveYeggeGooglePlatformRant.md

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real