Skip to content

Instantly share code, notes, and snippets.

View benatkin's full-sized avatar

Benjamin Atkin benatkin

View GitHub Profile
# 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
require File.dirname(__FILE__) + '/helper'
class TestPost < Test::Unit::TestCase
def setup
end
def test_likes_babies
assert true
end
@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.
cd $(dirname $(gem which git -q))
#!/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
#!/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.
#
defaults domains | ruby -e 'puts STDIN.readline.split(/,\s*/).join("\n")' | fgrep -i textmate
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
class Monthly
def initialize(date = Date.today)
@date = date
end
def first
Date.civil(@date.year, @date.month, 1)
end
def last
-- 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