Skip to content

Instantly share code, notes, and snippets.

View vinbarnes's full-sized avatar

Kevin R. Barnes vinbarnes

View GitHub Profile
@gnarmis
gnarmis / git-recent-branches
Last active August 29, 2015 14:01
List Git Branches by Recency
#!/bin/bash
#
# Blame @gnarmis if this doesn't work
#
# Put this anywhere on your $PATH (~/bin is recommended). Then git will see it
# and you'll be able to do `git recent-branches`.
#
# Show top 5 most recent branches:
# $ git recent-branches | head -n 5
#

There's no general rule you can follow here, because it's always going to depend on context. In my experience the kind of feedback loops you create, and the kind of safety nets you need are defined entirely by the domain, the organization, and the team culture.

Here are a few examples:

  1. I do a bit of work for a medium-sized dental clinic. The business manager there is really fun to work with, but has the tendency of changing his mind six times before he settles his ideas. So when he asks for a report, I don't put any effort at all into writing tests or worrying about minor bugs even, because my only goal is to flesh out in code something vaguely resembling what he asked for.

Often times, this means doing a handful of 30 minute prototypes until the requirements settle, each of which would have taken me 2 hours if I drove them via TDD. When things finally cool down, I evaluate the complexity and maintainability of the resulting code and either leave it untested, add some acceptance tests, backfill unit tes

@pasela
pasela / capture3_with_timeout.rb
Last active October 18, 2023 18:33
[ruby] capture3_with_timeout
# encoding: utf-8
require "timeout"
# Capture the standard output and the standard error of a command.
# Almost same as Open3.capture3 method except for timeout handling and return value.
# See Open3.capture3.
#
# result = capture3_with_timeout([env,] cmd... [, opts])
#

2013 Reading List

I read sixty-six books this year, one more than last. You can find the full list over at Good Reads, but here are my top picks.

Philosophy

A Manual For Creating Atheists by Peter Boghossian

The best book on teaching critical thinking I have read. Includes "intervention dialogues" transcripts, plenty of research, genuine compassion and empathy for other people, plus a wealth of experience in the author, who has been teaching philosophy and talking about faith for decades.

Nature's first green is gold,
Her hardest hue to hold.
Her early leaf's a flower;
But only so an hour.
Then leaf subsides to leaf.
So Eden sank to grief,
So dawn goes down to day.
Timezones: they're here to stay.
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@paneq
paneq / page.conf
Created April 3, 2013 14:57
nginx maintenance page that is JSON friendly
if (-f $document_root/system/maintenance.html) {
return 503;
}
error_page 503 @maintenance;
location @maintenance {
internal;
if ($http_accept ~ json) {
return 503 "{}";
}
$(document).ready(function() {
// automatically fix obfuscated email addresses pasted into
// to/cc/bcc fields
$("textarea[name=to], textarea[name=cc], textarea[name=bcc]")
.live('blur', function(e){
var text = $(this).val();
var separators = ['_', ' ', '\\[', '\\]', '\\(', '\\)'];
var separatorExp = '(' + separators.join('|') + ')+';
@eric
eric / _using_it.rb
Created March 16, 2012 20:41
Use Arel in Rails 2.3
>> engine = ArelBack::Engine.new(ar.connection, Arel::Visitors::MySQL)
>> table = Arel::Table.new(ar.table_name, engine)
>> table.project(Arel.sql('*')).to_sql
=> "SELECT * FROM `awesome_table` "
>>
@jupp0r
jupp0r / emacs.rb
Created March 1, 2012 01:11
Homebrew Formular enabling Lion Fullscreen for Emacs 24 git HEAD
require 'formula'
class Emacs < Formula
homepage 'http://www.gnu.org/software/emacs/'
url 'http://ftpmirror.gnu.org/emacs/emacs-23.4.tar.bz2'
mirror 'http://ftp.gnu.org/pub/gnu/emacs/emacs-23.4.tar.bz2'
md5 '070c68ad8e3c31fb3cb2414feaf5e6f0'
fails_with_llvm "Duplicate symbol errors while linking.", :build => 2334