Skip to content

Instantly share code, notes, and snippets.

View benatkin's full-sized avatar

Benjamin Atkin benatkin

View GitHub Profile
@benatkin
benatkin / chipotle.swift
Last active August 29, 2015 14:02
lolz
enum EntreeType : Int {
case Burrito, BurritoBowl, CrispyTacos, SoftTacos, Salad
}
enum Filling : Int {
case Chicken, Steak, Barbacoa, Carnitas, Sofritas, Veggie
var price : Int {
get {
switch self {
case .Chicken, .Sofritas, .Veggie {
@benatkin
benatkin / expect-to-should.txt
Last active August 29, 2015 14:06
rspec: moving from expect to should with vim regexes
s/expect(\([^)]*\)).to /\1.should /
s/eq(\([^)]\+\))/== \1/
s/JSON.parse.*)$/\0.with_indifferent_access/
s/\['\([^']\+\)'\]/[:\1]/g
@benatkin
benatkin / repl.js
Last active August 29, 2015 14:08
node repl tricks
// add ;0 to suppress long results, like a process or a mongoose connection
process;0
// capture information from async calls. doesn't work on calls that use the arity. make a custom call for those.
var results = [], capture = function() { results.unshift([].slice.call(arguments)) }
// handle uncaught exceptions so a mistake in the console doesn't bounce you out of your session
process.on('uncaughtException', function(err) { console.log('***uncaught***', err); });0
# 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