Skip to content

Instantly share code, notes, and snippets.

View gaustin's full-sized avatar

Grant Austin gaustin

  • Minneapolis, MN
View GitHub Profile
@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active July 4, 2024 13:50
Merge vs. Rebase vs. Squash

I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.

I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@JEG2
JEG2 / surprise.rb
Created February 19, 2015 15:28
Is this a bug in Ruby or just a poor method definition on my part?
class HashLike
def to_hash
{a: 1, b: 2}
end
end
def surprise(*args, keyword: nil)
p args
end

Gitter Shortcuts

I have several pieces of feedback on the shortcuts. The most significant feedback is that, with keyboard shortcuts, staying within conventional "vocabulary" is vitally important. When you use a web browser, any web browser, you can rely on Ctrl-Tab moving between tabs. Even more broadly, in almost any application regardless of purpose, you can rely on Cmd-N to open a "new thing", be it a document, a window, a message, or anything.

Keyboard shortcuts are productive because of these conventions. Gitter appears to eschew almost all conventional shortcuts for analogous actions, and this is a large problem. There are three obvious examples of this:

  • Cmd-Ctrl-C focuses chat input. If we look at other chat applications, we see that there are several very standard solutions to this user action. The most common is that the chat field simply always has focus. Gitter does special things with text selection though, so it's fair to say that this might not be an answer. This lead
@patio11
patio11 / annual-prepay.md
Last active February 23, 2024 11:16
Appointment Reminder Annual Pre-pay copy (2014)

Notes

This is the latest version of an email which I send periodically, offering customers the opportunity to pre-pay for SaaS in return for a discount. The benefits to the SaaS company are better cash flow and reduced churn rate. The benefits to the customer are, well, in the email. This genre of email has produced hundreds of thousands of dollars in pre-pays for some companies I work with, and it rarely requires any more work than this example.

I've put $79 is as a placeholder for the cost of the user's plan. We calculate that for each account, naturally, along with the billing contact's name.

Subject: Save $79 on Appointment Reminder (and get a tax write-off) Formatting: 100% plain text. Gmail automatically links up the central link. From: Patrick McKenzie (Appointment Reminder) patrick@appointmentreminder.org

Give me back my sanity

One of the many things I do for my group at work is to take care of automating as many things as possible. It usually brings me a lot of satisfaction, mostly because I get a kick out of making people's lives easier.

But sometimes, maybe too often, I end up in drawn-out struggles with machines and programs. And sometimes, these struggles bring me to the edge of despair, so much so that I regularly consider living on a computer-less island growing vegetables for a living.

This is the story of how I had to install Pandoc in a CentOS 6 Docker container. But more generally, this is the story of how I think computing is inherently broken, how programmers (myself included) tend to think that their way is the way, how we're ultimately replicating what most of us think is wrong with society, building upon layers and layers of (best-case scenario) obscure and/or weak foundations.

*I would like to extend my gratitude to Google, StackOverflow, GitHub issues but mostly, the people who make the

@aphyr
aphyr / gist:aa3de337d12ac886eb96
Created October 9, 2014 23:59
Functional clojure.test
(require '[clojure.test :as test])
; Rewrite clojure.test to generate data structures instead of writing to
; stdout
(def ^:dynamic *results*
"Bound dynamically to an atom wrapping a vector of test report maps")
(defn add-name
"Given a testing report map, assoc's on a :name derived from the current
`clojure.test/testing` context."
@michaelfeathers
michaelfeathers / gist:56f34287dbb55dc0d4a2
Last active August 29, 2015 14:02
An example of Literate Chaining Style in Ruby. The Kernel#c method is a pass through that serves as a placeholder for a comment and a convenient place for tracing.
# Accepts program file names on the command line and renders
# their text to stdout as a sequence of spoken words
token_map = {
"[" => "left square-bracket",
"]" => "right square-bracket",
"!" => "exclamation-point",
"\\" => "back slash",
"#" => "pound sign",
"\"" => "double-quote",
@pcperini
pcperini / BlockChaining.swift
Created June 5, 2014 20:12
Chain blocks for asynchronous, callback-based execution. Always ends in main queue.
operator infix ~> { associativity right }
@infix func ~>(firstBlock: (() -> Void), secondBlock: (() -> Void)) -> (() -> Void) {
return {
dispatch_async(dispatch_get_global_queue(-32768, 0), {
firstBlock()
dispatch_async(dispatch_get_main_queue(), secondBlock)
})
}
}
destructuring_assignment_for_named_local_args() {
declare numbers letters words
read numbers letters words <<<"$@"
echo "$numbers"
echo "$letters"
echo "$words"
}
destructuring_assignment_for_named_local_args 123 abc "Hello world"