Skip to content

Instantly share code, notes, and snippets.


Austin Taylor austintaylor

View GitHub Profile
View the_thing.html
<p> G.K. Chesterton, The Thing</p>
austintaylor / notes.txt
Created December 15, 2016 16:47
Notes apps I have tried
View notes.txt
Notes apps I have tried
- Evernote
- way too busy
- tags
- skitch garbage
- no nested folders
- limited features unless you pay a subscription
- OneNote
- not really a text editor (weird text box stuff)
- too heavy
austintaylor / userscript.css
Last active February 17, 2016 22:58 — forked from banderson623/userscript.js
My customizations for Slack in
View userscript.css
.bot_message {
background: #F2F2F2 !important;
border-top: 8px solid #F2F2F2;
color: #666;
margin: 0 !important;
.message {
margin: 4px 0;
View dynamic-programming.clj
; Given a list of permutations, only keep the highest scoring option
; for each unique key as returned by the key function and the score
; function.
(defn prune [s key-f score-f]
(map (fn [[k v]] (apply max-key score-f v)) (group-by key-f s)))
; Iterate over the provided starting value until the condition is met.
(defn iterate-until [f until-f start]
(first (drop-while (complement until-f) (iterate f start))))
View cellWidth.m
- (CGFloat)cellWidthForStyle:(UITableViewStyle)style accessoryType:(UITableViewCellAccessoryType)accessoryType {
CGFloat width = self.view.frame.size.width;
CGFloat accessoryWidth;
CGFloat margin;
if (IOS7) {
if (accessoryType == UITableViewCellAccessoryDisclosureIndicator) {
accessoryWidth = 33;
} else {
if (accessoryType == UITableViewCellAccessoryDisclosureIndicator) {
View 01.rb
class CLI
def process(input)
if input == "q"
puts "Goodbye"
elsif input == "tweet"
puts "tweeting"
elsif input == "dm"
puts "direct messaging"
elsif input == "help"
puts "helping"

So I had this situation where I needed to delete an object from the database, if it existed. This is what I wrote:

Ruby Option 1

obj = get_object(1)
obj.destroy if obj

And as I wrote this, it seemed a bit awkward to me. We always said Ruby had a really elegant syntax, but I guess I've come to the place where I find it a little grating. The thing about this example is the asymmetry of it. Conceptually I feel like the if check goes with the assignment, but it's separated from it in a strange way.

Ruby Option 2

austintaylor /
Created July 5, 2012 21:55
An example of creating a UserVoice SSO token using cryptojs
austintaylor / gist:2790526
Last active October 5, 2015 10:07
Valid ruby syntax
View gist:2790526
1.9.3p0 :001 > % % % % %
=> "%"
1.9.3p0 :002 > % % % % % % % % % % %
=> "%"
1.9.3p0 :003 > !?!??!:?!
(irb):70: warning: string literal in condition
=> "!"
1.9.3p0 :004 > % . . * 0
=> ""
1.9.3p0 :005 > 0_0

(from Haskell and Yesod by Michael Snoyman)

However, there is one issue that newcomers are often bothered by: why are IDs and values completely separate? It seems like it would be very logical to embed the ID inside the value. In other words, instead of having:

data Person = Person { name :: String }