Skip to content

Instantly share code, notes, and snippets.

View chrisroos's full-sized avatar

Chris Roos chrisroos

View GitHub Profile
@chrisroos
chrisroos / migration.rb
Created February 14, 2011 13:20
A test of whether the ActiveRecord ruby schema format supports bigints
# Create a table in a migration, testing both :integer with a limit of 8, and a :bigint
create_table :people, :force => true do |t|
t.column :col_1, :integer, :limit => 8
t.column :col_2, :bigint
t.column :col_3, :integer
end
@chrisroos
chrisroos / time_zone_test.rb
Created March 28, 2011 10:33
A test that attempts to ensure we don't run into problems with daylight savings
require 'test_helper'
class TimeZoneTest < ActiveSupport::TestCase
should "only use instances of TimeWithZone, not instances of Time" do
directories = Dir.glob(File.join(Rails.root, '**', '*.rb'))
matching_files = directories.select do |filename|
match = false
File.open(filename) do |file|
match = file.grep(%r{Time\.(now|utc)}).any?
@chrisroos
chrisroos / time_zone_test.rb
Created March 28, 2011 10:33
A test that attempts to ensure we don't run into problems with daylight savings. Credit for the test goes to James Mead.
require 'test_helper'
class TimeZoneTest < ActiveSupport::TestCase
should "only use instances of TimeWithZone, not instances of Time" do
directories = Dir.glob(File.join(Rails.root, '**', '*.rb'))
matching_files = directories.select do |filename|
match = false
File.open(filename) do |file|
match = file.grep(%r{Time\.(now|utc)}).any?
@chrisroos
chrisroos / asterisk-homebrew-install.txt
Created April 2, 2011 09:13
The output of using Homebrew to install Asterisk. This version of Asterisk fails to start when including any modules.
Chris-Rooss-MacBook-Pro-2:local chrisroos$ brew install -v asterisk
==> Downloading http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.6.1.6.tar.gz
File already downloaded and cached to /Users/chrisroos/Library/Caches/Homebrew
/usr/bin/tar xf /Users/chrisroos/Library/Caches/Homebrew/asterisk-1.6.1.6.tar.gz
==> Downloading patches
==> Patching
/usr/bin/patch -f -p1 -i 001-homebrew.diff
patching file sounds/Makefile
==> ./configure --prefix=/usr/local/Cellar/asterisk/1.6.1.6 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc --host=x86_64-darwin
./configure --prefix=/usr/local/Cellar/asterisk/1.6.1.6 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc --host=x86_64-darwin
@chrisroos
chrisroos / asterisk-homebrew-interactive-install.txt
Created April 2, 2011 09:14
The output of using Homebrew interactive mode to install Asterisk. This version of Asterisk starts correctly even when including modules.
Chris-Rooss-MacBook-Pro-2:~ chrisroos$ brew install --interactive asterisk
==> Downloading http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.6.1.6.tar.gz
File already downloaded and cached to /Users/chrisroos/Library/Caches/Homebrew
==> Downloading patches
==> Patching
patching file sounds/Makefile
==> Entering interactive mode
Type `exit' to return and finalize the installation
Install to this prefix: /usr/local/Cellar/asterisk/1.6.1.6
bash-3.2$ ./configure --prefix=/Users/chrisroos/wem-asterisk-homebrew --host=x86_64-darwin
@chrisroos
chrisroos / git-compare-upstream.rb
Created April 21, 2011 16:15
This attempts to show useful differences between two repos (probably your fork and the upstream original)
#!/usr/bin/env ruby
# This attempts to show useful differences between an upstream repo and your local copy.
# The motivation is that I want to be able to see differences between my forks of other github repos.
unless upstream_repo = ARGV.shift
puts "Usage: #{File.basename(__FILE__)} upstream-repo"
exit 1
end
@chrisroos
chrisroos / antisocial.js
Created May 25, 2011 13:35
Javascript snippet to unfollow all twitter followers
$('.unfollow-button').each(function() { $(this).trigger('click'); });
@chrisroos
chrisroos / gist:1106395
Created July 26, 2011 09:44 — forked from adamcharnock/gist:1073858
Initial work on a Ruby/Rails setup script for https://continuous.io
#!/bin/bash -e
# The following variables are available to you
# (values are examples only)
#
# TIMEZONE="UTC" # The timezone this server should be given
# CI_USER="ci" # The user to setup and run the tests as
# # (although you are free to ignore this)
#
# GIT_URI="git://github.com/andymccurdy/redis-py.git" # The Git URL for this project
@chrisroos
chrisroos / connfu-output.xml
Created August 5, 2011 16:52
Output of attempting to dial two calls using Prism
# Logfile created on 2011-08-05 17:47:23 +0100 by logger.rb/25413
Tropo build: b336
RECEIVED:
<presence from="c36756cc-321f-4074-91a4-e6a4d4940d1f@127.0.0.1" to="usera@127.0.0.1/voxeo">
<offer xmlns="urn:xmpp:rayo:1" to="sip:usera@127.0.0.1" from="sip:chrisroos@127.0.0.1">
<header name="Min-SE" value="90"/>
<header name="Content-Length" value="459"/>
<header name="Supported" value="replaces"/>
<header name="To" value="&lt;sip:usera@127.0.0.1&gt;"/>
<header name="Contact" value="&quot;Local Prism - User B&quot; &lt;sip:chrisroos@10.35.133.29:59699;ob&gt;"/>