Skip to content

Instantly share code, notes, and snippets.

View cee-dub's full-sized avatar

Cameron Walters (cee-dub) cee-dub

View GitHub Profile
@cee-dub
cee-dub / postgres_timestamp_defaults.rb
Created January 29, 2012 20:53
Convenient methods to let PostgresQL manage created/updated_at
require 'active_support/core_ext/string/filters'
module PostgresTimestampDefaults
def add_timestamp_defaults(table_name)
add_default_now(table_name, :created_at)
add_default_now(table_name, :updated_at)
add_updated_at_trigger(table_name)
end
def add_default_now(table_name, column_name)
@cee-dub
cee-dub / orderedlogger.go
Created July 10, 2020 16:37
Basic ordered JSON logger inspired by go-kit
package olog
import (
"encoding"
"encoding/json"
"fmt"
"github.com/go-kit/kit/log"
"github.com/mickep76/mapslice-json"
)
@cee-dub
cee-dub / dnsmasq.conf
Created January 14, 2012 23:23
Generic configuration files for *.#{hostname}.local wildcard DNS with dnsmasq and mDNSResponder
# Add domains for which you want to force to an IP address here.
# This is the magic sauce for making *.#{hostname}
# always route to the localhost
address=/#{hostname}/127.0.0.1
address=/#{hostname}/::1
mx-host=#{hostname},#{hostname},10
# Extra options that make dnsmasq play nice
log-queries
@cee-dub
cee-dub / sse.go
Created May 30, 2014 21:08
Simple Golang SSE example using CloseNotifier
package main
import (
"fmt"
"log"
"net/http"
"time"
)
// SSE writes Server-Sent Events to an HTTP client.
@cee-dub
cee-dub / brew-services.rb
Created September 26, 2012 04:15 — forked from bryanveloso/brew-services.rb
External script for homebrew to simplify starting services via launchctl, out of the box support for any formula which implements #startup_plist. (This version fixes the deprecation warning raised on Formula.resolve_alias.)
#!/usr/bin/env ruby -w
# brew-services(1) - Easily start and stop formulas via launchctl
# ===============================================================
#
# ## SYNOPSIS
#
# [<sudo>] `brew services` `list`<br>
# [<sudo>] `brew services` `restart` <formula><br>
# [<sudo>] `brew services` `start` <formula> [<plist>]<br>
@cee-dub
cee-dub / nginx.conf
Created January 15, 2012 01:15
Homebrew formula to load Nginx listening on standard ports with convenient user-land configuration.
user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
@cee-dub
cee-dub / org.nginx.nginx.plist
Created January 15, 2012 01:50
Generic LaunchDaemon plist for Nginx
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.nginx.nginx</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
@cee-dub
cee-dub / 1_install_transcript.sh
Created January 10, 2012 07:24
Installing Ruby 1.9.3 & gem dependencies on Mac OS X Lion
# Install Xcode from the Mac App Store
open /Applications/Install\ Xcode.app # complete the installation
# Install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
# Install RVM
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
# Install some libraries to link ruby and gems against

##YC-backed startup, looking for extremely talented Obj-C/Rails engineer for first technical hire##

We're building a new platform for mobile commerce--an elegant, gorgeous experience for buying and selling. The founding team consists of two people with extensive experience in user acquisition, product design, and development. We've raised money from some of the valley's top investors, and have a ton of support from the most brilliant product minds in SF.

If you're a hacker with interest in an early position at a YC-backed startup, we'd love to talk. We're looking for a hardcore generalist, which means you should:

  • understand undocumented libraries and code bases quickly
  • have a strong understanding of technologies up and down the stack: PostgreSQL, UIWebViews, and everything in between (Rails!)
  • understand what it means to work in an intense startup environment
  • learn quickly, we value raw intelligence pretty highly
def should_be_a_subset(superset, records_selected_by_scope, &condition)
flunk "Your superset is empty" if superset.empty?
flunk "Your scope did not select any records" if records_selected_by_scope.empty?
records_selected_by_block, records_excluded_by_block = superset.partition(&condition)
flunk "Your test condition did not select any records" if records_selected_by_block.empty?
flunk "Your test condition did not exclude any records" if records_excluded_by_block.empty?
records_selected_by_scope.map(&:id).should =~ records_selected_by_block.map(&:id)
end