Skip to content

Instantly share code, notes, and snippets.

View r00k's full-sized avatar
💭
Working on Tuple (https://tuple.app)

Ben Orenstein r00k

💭
Working on Tuple (https://tuple.app)
View GitHub Profile
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: yosog-0.0.0 (user goal)
rejecting: yosog-0.0.0:!test (global constraint requires opposite flag
selection)
trying: yosog-0.0.0:*test
trying: yesod-test-1.4.3.1 (dependency of yosog-0.0.0:*test)
trying: HUnit-1.2.5.2 (dependency of yesod-test-1.4.3.1)
trying: yesod-static-1.4.0.4 (dependency of yosog-0.0.0)
trying: cryptohash-conduit-0.1.1 (dependency of yesod-static-1.4.0.4)
@r00k
r00k / vimrc
Last active May 13, 2023 09:34
A minimal vimrc for beginners
" A minimal vimrc for new vim users to start with.
"
" Referenced here: http://www.benorenstein.com/blog/your-first-vimrc-should-be-nearly-empty/
" Original Author: Bram Moolenaar <[email protected]>
" Made more minimal by: Ben Orenstein
" Last change: 2012 Jan 20
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
@r00k
r00k / inject_spec.rb
Created January 9, 2015 17:26
Leveling up our inject skills
require 'rspec'
def sum(numbers)
numbers.inject(0) { |sum, number| sum + number }
end
def product(numbers)
numbers.inject(1) { |sum, number| sum * number }
end
##
# Helpers for randomized person testing.
module PersonsHelper
##
# Generate the next n elements for the array, but in a predefined manner.
class FakeElementGenerator
##
# Generate elements, the first of which must be start_with.
def initialize(start_with:)
@start = start_with
2014-03-20
Line 1
Line 2
2014-03-21
Line 1
Line 2
@r00k
r00k / ex5.rb
Last active August 29, 2015 13:58
Another DIP example
# Before:
class Product < ActiveRecord::Base
has_many :purchases
end
class Purchase < ActiveRecord::Base
belongs_to :product
# We don't want the receipt responsibilities in Purchase
def has_receipt?
@r00k
r00k / noodle.clj
Last active December 31, 2015 06:38
Parses zsh_history. It calculates the commands that you spend the most time typing (length of command * frequency of typing it) and returns the top-ten most costly commands with their frequencies.
(ns noodle.core)
(defn history-line->command
"Returns the command from a zsh_history-style line"
[line]
(nth (clojure.string/split line #"\s+") 2))
(defn weight
"Returns a number representing how much time you've spent typing a command"
[command invocation-count]
@r00k
r00k / gist:6201907
Last active December 20, 2015 21:59
Talk proposal. What do you think?

Frequently Asked Questions

As a mentor for thoughtbot's Prime service, I've provided coaching to over 100 developers.

In my talk, I'll share the questions I'm asked repeatedly, and how I answer them.

This discussion will be targeted at beginner and intermediate developers striving to improve.

Likely discussion includes:

  • What should I do if I inherit an app with no tests?
@r00k
r00k / gist:5885955
Created June 28, 2013 16:19
Notes for my talk at Engineers4Engineers at Constant Contact on 6/28/13.
My name is Ben Orenstein and I work at thoughtbot in Boston.
Notes will be published.
I'd like to tell you a story. (5:42)
I've never talked about this publicly.
Umass.
Second job.
Version control.
Successful since then.
name | setting
------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
application_name | psql
archive_command | test -f /etc/postgresql/wal-e.d/ARCHIVING_OFF || envdir /etc/postgresql/wal-e.d/env wal-e wal-push %p
archive_mode | on
archive_timeout | 60
bytea_output | escape
checkpoint_completion_target | 0.7
checkpoint_segments | 40
client_encoding | UTF8