This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
NewerOlder