Skip to content

Instantly share code, notes, and snippets.

@esmooov
esmooov / ctrr.md
Created May 25, 2012 16:50
Carats and Tildes, Resets and Reverts

Until last night I lived in fear of tildes, carats, resets and reverts in Git. I cargo culted, I destroyed, I laid waste the tidy indicies, branches and trees Git so diligently tried to maintain. Then Zach Holman gave a talk at Paperless Post. It was about Git secrets. He didn't directly cover these topics but he gave an example that made me realize it was time to learn.

A better undo

Generally, when I push out bad code, I panic, hit git reset --hard HEAD^, push and clean up the pieces later. I don't even really know what most of that means. Notational Velocity seems to be fond of it ... in that I just keep copying it from Notational Velocity and pasting it. Turns out, this is dumb. I've irreversibly lost the faulty changes I made. I'll probably even make the same mistakes again. It's like torching your house to get rid of some mice.

Enter Holman. He suggests a better default undo. git reset --soft HEAD^. Says it stag

@esmooov
esmooov / checkout.md
Created May 31, 2012 15:54
The Secret Passions of Git Checkout

The Secret Passions of Git Checkout


The Hand of God

Master Hand

Git checkout can do almost anything ... or, at least, many things. It can switch branches. It can mix and match branches. It can resolve merge conflicts. It can give you a scratchpad to test things. It can even be used to interactively patch files. It's so powerful because it's so abstract. But much like numinous mystics, abstraction makes it confusing.

Basically git checkout does two things:

@esmooov
esmooov / massmedia.md
Created June 4, 2012 14:48
Mass Media As Folk Media

Mass Media As Folk Media


(draft alert: this is not organized, just collected)

Diablo 3

Diablo 3

Everyone is complaining that Diablo 3, the fastest-selling video game of all time, is not enough like Diablo 2. See, in Diablo you collect items by killing demons. In Diablo 2, trading these items involved eBay, making ad hoc games to barter( and try not to get cheated), or brokering deals in chat rooms and lobbies. Diablo 3 "solves" this inconvenience by supplying an auction house where players can auction/sell their items. It's much more efficient. Everyone should like it, right?

<!DOCTYPE html>
<html>
<head>
<title>Transform</title>
<link href="assets/demoStyles.css" rel="stylesheet" type="text/css" />
<script src="http://code.createjs.com/preloadjs-0.1.0.min.js"></script>
<script type="text/javascript" src="../src/easeljs/utils/UID.js"></script>
<script type="text/javascript" src="../src/easeljs/geom/Matrix2D.js"></script>
unbind C-b
set -g prefix `
set -g default-terminal "screen-256color"
set -g status-bg black
set -g status-fg white
set -g status-interval 60
set -g status-left-length 30
set -g status-left '#[fg=green](#S) #(whoami)@#H#[default]'
set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=blue]%H:%M#[default]'
set-window-option -g window-status-current-bg red

Good Evening.

We have received reports that a Kaiju has broken through the Pacific wall. We don't know how many have died, but we can assume it was in the tens of thousands.

People are saying that this is the end. People are saying that we have lost. [Beat] I ... I don't know what I think. In the last year, we have seen cities fall. We have seen Jaegers humbled [beat] broken. We have seen children die. Things [beat] things look bleak. But this is not an issue about monsters. This is not about robots and it certainly is not an issue about the strength of our spirit. [beat] This is an issue about a wall.

Martin Luther once wrote, "The Romanists, with great adroitness, have built three walls about them, behind which they have hitherto defended themselves in such wise that no one has been able to reform them; and this has been the cause of terrible corruption throughout all Christendom." Barack Obama declaimed, "No wall is high enough and no Iron Dome is strong enough or perfect enough to stop every enemy

NAME | Hour | Hour | Hour | Hour | Hour | Hour | Hour | Hour | Hour | Hour |
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| | | | | | | | | | |
=============== =============== =============== =============== =============== =============== =============== =============== =============== =============== ===============
Loite, | Ian | Mark | Alex | Michael | Chen | Sam | Brian | Jun |
Tiina | C. | Abramson | Goodlett | Rivera | Shen | Wolson | Powers | Kim
-- GOAL: push values of type Either a b to a Stack and maintain a type-level
-- count of Left (n) and Right (m) cases
data Stack a b = MkStack (n : Nat ** (m : Nat ** Vect (n + m) (Either a b)))
push : Either a b -> Stack a b -> Stack a b
push (Left l) (MkStack (n ** (m ** v))) = MkStack ((S n) ** (m ** (Left l :: v)))
push (Right r) (MkStack (n ** (m ** v))) = MkStack (n ** ((S m) ** v'))
where v' : Vect (n + S (m)) (Either a b)
v' = rewrite (sym $ plusSuccRightSucc n m) in Right r :: v
---------- Assumptions: ---------- │~
k : Nat │~
m : Nat │~
---------- Goal: ---------- │~
{hole2} : inverseA (replace (plusCommutative m (S k)) │~
sfPush :: SF () a -> SF [a] [a]
sfPush sf = proc l -> do
newElem <- sf -< ()
returnA -< (newElem : l)