Skip to content

Instantly share code, notes, and snippets.

Avatar

Benjamin Atkin benatkin

View GitHub Profile
View gist:42055
# convert from 3 spaces to 4 spaces
cat test.py | unexpand -t 3 --first-only | expand -t 4 --initial
# requires GNU expand & unexpand
# on mac, run "sudo port install macports" & prefix unexpand/expand with a g
View gist:42447
require File.dirname(__FILE__) + '/helper'
class TestPost < Test::Unit::TestCase
def setup
end
def test_likes_babies
assert true
end
View gist:42469
@BenJammin I consider you to be a developer (but not so much a programmer).
There needs to be a word for people who create (develop) apps/sites in
general. For me that word is developer. I don't consider programmer and
developer to mean the same thing. I don't consider either word to imply
competence. I wonder if there aren't other people who make the same
distinction between the two words.
View gist:42995
cd $(dirname $(gem which git -q))
View tweetdeck
#!/usr/bin/env ruby
require 'rubygems'
require 'sequel'
require 'optparse'
class Account
def initialize(name='')
pref_dir = File.expand_path('~/Library/Preferences')
db_file = Dir.glob("#{pref_dir}/TweetDeck*/*/*#{name}.db").first
View odde
#!/bin/bash
# odde (Optical Drive Disabler and Enabler)
# Ben Atkin (ben@benatkin.com)
# 2009-01-05
#
# NO WARRANTY!
#
# Please only run this if you can grok the code.
#
View gist:44083
defaults domains | ruby -e 'puts STDIN.readline.split(/,\s*/).join("\n")' | fgrep -i textmate
View oops
batkin:asciidoc ben$ history | grep 'hg clone' | tail -n 1
636 history | grep 'hg clone' | tail -n 1
batkin:asciidoc ben$ history | grep 'hg clone' | tail -n 2
636 history | grep 'hg clone' | tail -n 1
637 history | grep 'hg clone' | tail -n 2
batkin:asciidoc ben$ history | grep 'hg clone' | tail -n 4
573 hg clone http://hg.sharesource.org/asciidoc/
636 history | grep 'hg clone' | tail -n 1
637 history | grep 'hg clone' | tail -n 2
638 history | grep 'hg clone' | tail -n 4
View monthly.rb
class Monthly
def initialize(date = Date.today)
@date = date
end
def first
Date.civil(@date.year, @date.month, 1)
end
def last
View gist:104645
-- List all nvarchar and varchar columns in SQL Server database
SELECT OBJECT_NAME(col.OBJECT_ID) as [TableName], col.[name] as [ColName], typ.[name]
FROM sys.all_columns col
INNER JOIN sys.objects obj
ON col.object_id = obj.object_id
INNER JOIN sys.types typ
ON col.user_type_id = typ.user_type_id
WHERE col.user_type_id IN (167,231)
AND obj.type = 'U'
ORDER BY name, TableName, ColName