Skip to content

Instantly share code, notes, and snippets.

View BaseCase's full-sized avatar

Casey Brant BaseCase

  • Madison, WI
View GitHub Profile
@BaseCase
BaseCase / dc_2017_biblio.md
Last active January 23, 2020 05:13
List of resources recommended or mentioned by the speakers at Deconstruct 2017

Deconstruct 2017 Bibliography

Here are all of the resources mentioned by Deconstruct 2017 speakers, along with who recommended what. Please post a comment if I missed something or have an error!

DC 2017 Speakers' Choice Gold Medalist

  • Seeing Like a State by James Scott

Books

  • Public Opinion by Walter Lippmann (Evan Czaplicki)
  • A Pattern Language by Christopher Alexander (Brian Marick)
  • Domain Driven Design by Eric Evans (Brian Marick)
@BaseCase
BaseCase / hr.c
Last active April 10, 2017 14:49
Print a horizontal rule on your terminal using given string
/*
* hr - stupid little horizontal rule thing for a bash terminal
*
*
* COMPILE: `clang -ltermcap hr.c -o hr`
* then dump the binary somewhere on your PATH
*
* RUN: `hr` // fills the width of your terminal with '-'
* `hr hello` // repeats "hello" until width of terminal is filled
*

Keybase proof

I hereby claim:

  • I am BaseCase on github.
  • I am basecase (https://keybase.io/basecase) on keybase.
  • I have a public key whose fingerprint is 3759 4E77 378F 0679 232F 83CD 3A1E 5599 AEB9 5BFD

To claim this, I am signing this object:

@BaseCase
BaseCase / HOWTO-interactive_rebase.md
Last active September 3, 2016 15:08
How to squash branches with interactive rebase

How to Squash Git Branches with Interactive Rebase

In this tutorial, we'll learn how to convert a git branch from many commits into a single commit before merging it. There's one key command to learn: git rebase -i

Prerequisites

Let's assume that you have a branch, feature/foo, that was branched off of develop. The git log might look something like this:

* baec937 (HEAD -> feature/foo) remove TODO comment
* 4fb174d add spec for foo model
* bb84984 update the foo serializers
@BaseCase
BaseCase / html_word_frequency.rb
Last active August 13, 2016 20:34
Quick and dirty word frequency count for (more or less) just the text part of an HTML file
#!/usr/bin/env ruby
class WordFrequencyCounter
DELIMITERS = [
" ",
"\n",
"<",
">",
".",

"Messy fridges are common, but their contents can be organized quickly and simply by standing things on end. I happen to love carrots, for example. If you open my fridge, you'll find carrots standing in the drink holders on the door."

"This is the routine I follow every day when I return from work. First, I unlock the door and announce to my house, “I’m home!” Picking up the pair of shoes I wore yesterday and left out in the entranceway, I say, “Thank you very much for your hard work,” and put them away in the shoe cupboard. Then I take off the shoes I wore today and place them neatly in the entranceway. Heading to the kitchen, I put the kettle on and go to my bedroom. There I lay my handbag gently on the soft sheepskin rug and take off my outdoor clothes. I put my jacket and dress on a hanger, say, “Good job!” and hang them temporarily from the closet doorknob. I put my tights in a laundry basket that fits into the bottom right corner of my closet, open a drawer, select the clothes I feel like wearing insid

@BaseCase
BaseCase / movie_time.py
Last active August 29, 2015 14:07
uses OMDB to grab running times for a list of movie titles
# Requires the 'requests' lib to be installed in your python path
# usage: `python movie_time.py "title 1" "title 2" "title 3" (etc.)`
# OR: `python movie_time.py -f filename` # file format should be newline separated list of titles
#
# output is a list of run times for each movie plus the total
# it will return 0 for the runtime of a movie it can't find
import sys
import requests
@BaseCase
BaseCase / gist:b62f39a4889ba3ebc0ae
Last active August 29, 2015 14:05
using a counter instead of range() in a while loop
a = [7,12,9,14,15,18,12]
b = [9,14,8,3,15,17,15]
big = []
i = 0
length = len(a)
while i < length:
big.append(max(a[i], b[i]))
i += 1
@BaseCase
BaseCase / add_property.js
Last active August 29, 2015 13:57
Makes it super easy to convert `foo.bar` and `foo.bar = baz` into method calls instead of property lookups!
function add_property(prop_name, default_value) {
var getter = this['get_' + prop_name] || default_getter(prop_name);
var setter = this['set_' + prop_name] || default_setter(prop_name);
Object.defineProperty(this, prop_name, {
get: getter.bind(this),
set: setter.bind(this),
enumerable: true
});
@BaseCase
BaseCase / build.js
Last active January 4, 2016 18:49
`chmod +x` then just `./build.js compress` and you're off
#!/usr/local/bin/node
var minify = require('uglify-js').minify;
var fs = require('fs');
var tasks = {
//tasks go here. here's an example Uglify:
compress: function() {
var minified = minify('input.js');
fs.writeFile('example.js', minified.code, function(err) {