Skip to content

Instantly share code, notes, and snippets.

View trobrock's full-sized avatar

Trae Robrock trobrock

View GitHub Profile
CREATE TABLE users (id serial PRIMARY KEY NOT NULL, username text NOT NULL);
INSERT INTO users (username) VALUES ('admin');
INSERT INTO users (username) VALUES ('pat');
CREATE RULE no_delete_admin AS ON DELETE TO users WHERE username='admin' DO INSTEAD NOTHING;
SELECT * FROM users;
DELETE FROM users;
SELECT * FROM users;
@jodosha
jodosha / 1-session.sh
Created May 31, 2012 12:42 — forked from vjt/1-session.sh
vjt's tmux RVM + ViM IDE setup
#!/bin/sh
#
# IDE Session starter - you should save this script as ~/bin/session, make it
# executable with chmod +x ~/bin/session, and then make a symlink to it for
# every application you want to start.
# E.g. ln -s session ~/bin/members creates a "members" symlink, and when you'll issue
# "members" on the command line this script will:
# Check if a tmux session named "members" exists
@sirupsen
sirupsen / vim7.3_mac_install.rb
Created July 27, 2011 21:57 — forked from pengwynn/vim7.3_mac_install.rb
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end
anonymous
anonymous / gist:1043991
Created June 24, 2011 00:42
Fork server to run integration tests while cleaning up processes.
pid = fork { exec("script/server") }
sleep(10)
puts "Test 1"
puts "Test 2"
puts "Test 3"
Process.kill("KILL", pid) rescue nil
pid, status = Process.waitpid2(pid)
@nstielau
nstielau / set_environment.rb
Created May 9, 2011 00:04
A Knife plugin to set node environment
## Knife plugin to set node environment
# See http://wiki.opscode.com/display/chef/Environments
#
## Install
# Place in .chef/plugins/knife/set_environment.rb
#
## Usage
# Nick-Stielaus-MacBook-Pro:chef-repo nstielau$ knife node set_environment mynode.net my_env
# Looking for mynode.net
# Setting environment to my_env
@mattpodwysocki
mattpodwysocki / jsconf2011-talks.txt
Created May 5, 2011 18:30
JSConf talks and resources
Track A
Bytes and Blobs – David Flanagan @__DavidFlanagan
Slides: http://davidflanagan.com/Talks/jsconf11/BytesAndBlobs.html
Conference Wifi Redux - Malte Ubi @cramforce
Sashimi: https://github.com/cramforce/Sashimi
Slides: http://social-traffic.streamie.org/preso/static/#slide1
Run Your JS everywhere with Jellyfish – Adam Christian @admc
@bcurren
bcurren / redis_pubsub_demo.rb
Created May 3, 2011 21:19 — forked from pietern/redis_pubsub_demo.rb
Updated redis pubsub with cramp
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@adamloving
adamloving / installer_controller.rb
Created February 1, 2011 06:11
Rails controller action for an HTML5 cache manifest file.
class InstallerController < ApplicationController
# Rails controller action for an HTML5 cache manifest file.
# Generates a plain text list of files that changes
# when one of the listed files change...
# So the client knows when to refresh its cache.
def cache_manifest
@files = ["CACHE MANIFEST\n"]
@files << 'favicon.ico'
@paneq
paneq / capc.rb
Created January 27, 2011 18:50
Creating an object with Capybara api and jumping into it.
#!/usr/bin/env ruby
require 'bundler'
Bundler.setup(:default, :test) if defined?(Bundler)
require "selenium-webdriver"
require 'capybara/dsl'
Capybara.default_driver = :selenium
Capybara.default_selector = :css
Capybara.default_wait_time = 5
@acrosa
acrosa / oauth-monkey-patch.rb
Created December 13, 2010 12:20
OAuth gem workaround on JRuby
module OAuth::Signature::HMAC
class Base < OAuth::Signature::Base
private
def digest
self.class.digest_class Object.module_eval("::Digest::#{self.class.digest_klass}")
digest = OpenSSL::Digest::Digest.new('sha1')
OpenSSL::HMAC.digest(digest, secret, signature_base_string)
end
end
end