Skip to content

Instantly share code, notes, and snippets.

View mhink's full-sized avatar

Matt Hink mhink

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mhink on github.
  • I am mhink (https://keybase.io/mhink) on keybase.
  • I have a public key ASD4_JoL6uLuSKirFTrtGCHmp16345uQ5OCen4yrmtwJrAo

To claim this, I am signing this object:

Dungeon Crawl Stone Soup version 0.21-a0-143-g1ab7d47 (tiles) character file.
Imem the Chopper (Minotaur Berserker) Turns: 71, Time: 00:00:31
Health: 15/19 AC: 13 Str: 21 XL: 1 Next: 41%
Magic: 0/0 EV: 3 Int: 4 God: Trog [*.....]
Gold: 0 SH: 0 Dex: 9 Spells: 0/0 levels left
rFire + . . SeeInvis . a - +0 hand axe
rCold + . . Gourm . (no shield)
const FooBar = () => (
<div>Hello, world!</div>
);
const FooBarEquivalent = () => (
React.createElement("div", {}, ["Hello, world!"])
);
const MyComponent = (
<FooBar />
@mhink
mhink / notify.rb
Created November 21, 2016 19:37
A quick ruby script for OS X notifications from the shell (even in tmux!)
#! /usr/bin/env ruby
require 'optparse'
@reattach = true
@title = "Shell Notification"
OptionParser.new do |opts|
opts.banner = "Usage: notify [options] \"This is a notification\""
opts.on("--no-reattach", "don't use 'reattach-to-user-namespace") do |noreattach|
@mhink
mhink / Vetupot.txt
Last active September 18, 2016 17:22
Dungeon Crawl Stone Soup version 0.18.1 (tiles) character file.
Vetupot the Impregnable (Minotaur Berserker) Turns: 37839, Time: 01:40:37
Health: 185/185 AC: 42 Str: 32 XL: 18 Next: 81%
Magic: 17/17 EV: 10 Int: 6 God: Trog [******]
Gold: 869 SH: 10 Dex: 16 Spells: 0 memorised, 17 levels left
rFire . . . SeeInvis + R - +14 obsidian axe {chop, +Fly Str+3 SInv *Curse} (curse)
rCold . . . Gourm . g - +9 plate armour of Philately {rElec rPois Int+2}
# A heavily annotated version of this script follows below.
module EachWindow
def each_window(n, &block)
if self.length < n
raise "Length must be greater than window size"
end
if block_given?
(0..self.size-n).each do |ix|
@mhink
mhink / gist:7491098
Created November 15, 2013 20:33
Recent bug discovery on a friend's team. Names have been changed to protect the not-so-innocent :D
jbarrow: can repro in console
mkniel: The 500 errors?
jbarrow: m? nah, scope to field thing
jbarrow: locking up
mkniel: oh, cool
jbarrow: there's a certain input size for which that scopes.subsets.flatMap(scopesToOptionalProfileFields.get).toSet.flatten just hangs
wblack: yeah it's really odd
wblack: just go with lists
jbarrow: m? no, I want subsets
snewton: Streams
@mhink
mhink / dynamic_dispatch_examples.rb
Last active October 22, 2015 23:26
Dynamic Dispatch: Compare/Contrast
class DynamicMethodDispatchExample
def do_something(what_to_do)
begin
self.send("provide_#{what_to_do}_string")
rescue NoMethodError => ex
raise ArgumentError
end
end
def provide_foo_string
@mhink
mhink / hamljstest
Created February 1, 2012 00:56
Index view located at ./views/index.haml
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
var app = module.exports = express.createServer();
@mhink
mhink / tmux_textaurant.sh
Created December 18, 2011 06:39 — forked from dpickett/tmux_textaurant.sh
scripted way to start your work in a Rails project
export WORKING_DIR=~/work/textaurant
cd $WORKING_DIR; mvim; gitx
tmux start-server
tmux new-session -d -s Textaurant -n work
tmux new-window -tTextaurant:1 -n server
tmux new-window -tTextaurant:2 -n test
tmux send-keys -tTextaurant:0 'cd $WORKING_DIR' C-m