Skip to content

Instantly share code, notes, and snippets.

View spraints's full-sized avatar
🦦

Matt Burke spraints

🦦
View GitHub Profile
@spraints
spraints / InspectExtensionTests.cs
Created July 30, 2009 17:29
Ruby's inspect for .NET
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace SEP.Extensions.Tests
{
[TestClass]
public class InspectExtensionTests
{
require 'zlib'
print Zlib::GzipReader.new($<).read
def printable(c)
c.sub!(/\d/) { |d| "_#{d}" }
{
'/' => '_slash_',
'_' => '_underscore_'
}[c] || c
end
(0..127).each do |n|
c = printable(n.chr)
require 'albacore'
require 'rexml/document'
# Will submit this as a patch when github starts letting me push again.
module Rake
class MSBuildTask
def define
task name do
fail unless @msbuild.build
end

Taking care of the animals

This is a description of how I take care of the animals. Some things have lots of detail, others don’t. Not all of the details are important. The important thing is for the animals to have enough food and water. They’ll let you know if you don’t give them enough.

Winter Schedule

Greenhouse assembly steps

  1. Sort pipes in pole barn into "use" and "not use".
    • "use" go to greenhouse site.
    • "not use" go (?) over the electric fence (?)
  2. Lay out site.
    • Ensure the corners are in the right place.
    • Run string.
  3. Pound in posts. Use a level to make sure they're vertical.
@spraints
spraints / add_putty_host.bat
Created March 18, 2010 15:43
Creates registry entries for a saved putty session with a window 80x40 and the ssh agent forwarded.
@echo off
setlocal
set alias=%1
set host=%2
set user=%3
if "" == "%alias%" goto :help
if "" == "%host%" set host=%alias%
if "" == "%user%" set user=%USERNAME%
rem echo Host: %host%
rem echo User: %user%
@spraints
spraints / Inspect.cs
Created May 21, 2010 17:09
An alternative to gist: 158795
// an alternative to http://gist.github.com/158795
// note: this version doesn't deal with cycles at all.
private string Inspect(object x)
{
return TryNullInspect(x)
?? TryInspect<string>(x, s => "\"" + s.Replace("\"", "\\\""))
?? TryInspect<DictionaryEntry>(x, e => "{ " + e.Key + " => " + Inspect(e.Value) + " }")
?? TryInspect<IEnumerable>(x, e => "[ " + String.Join(", ", e.Cast<object>().Select(Inspect).ToArray()) + " ]")
?? x.ToString();
require 'stringio'
require 'open3'
require 'pp'
$ref = 'HEAD'
unless ARGV.size == 2
puts "Usage: #{$0} <subtree name> <destination branch>"
exit 1
end
@spraints
spraints / count_newlines.rb
Created June 28, 2010 21:00
This doesn't work. It says everything is a unix newline.
def report_newlines filename, io
windows_newlines = 0
unix_newlines = 0
last_line_is_bare = false
while line = io.gets
last_line_is_bare = false
if line =~ /\r\n$/
windows_newlines += 1
elsif line =~ /\n$/