Skip to content

Instantly share code, notes, and snippets.

View hannahwhy's full-sized avatar

Hannah Yip hannahwhy

View GitHub Profile
From 93b1fdda55459dab8eb28441f1c2869df0cd9186 Mon Sep 17 00:00:00 2001
From: David Yip <yipdw@northwestern.edu>
Date: Mon, 14 Dec 2009 02:36:55 -0600
Subject: [PATCH 1/2] Load 'active_record', not 'activerecord': silences deprecation warnings.
---
test/test_helper.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/test_helper.rb b/test/test_helper.rb
From 3113c02569fd546ab0876890c5cfbb6a09808145 Mon Sep 17 00:00:00 2001
From: David Yip <yipdw@member.fsf.org>
Date: Tue, 29 Dec 2009 01:01:30 -0600
Subject: [PATCH] Compatibility fix for block arity changes in Ruby 1.9.
The behavior of #call on lambdas and procs is now different:
> Proc.new { }.call(self)
=> nil
> lambda { }.call(self)
From 5d01e863ced6160fc09956259f573988e4e21ddc Mon Sep 17 00:00:00 2001
From: David Yip <yipdw@northwestern.edu>
Date: Fri, 19 Mar 2010 12:05:29 -0500
Subject: [PATCH] Use a text? predicate for determining whether a field type is suitable for full-text search.
Previously, class matching on Type::TextType was used, which not only
prohibited custom definitions of full-text search field types, but
also resulted in unexpected behavior when using subclasses of
Type::TextType.

Environment

yipdw@vm0:~/src/issue-210$ ruby -v
ruby 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2010.01

yipdw@vm0: ~/src/issue-210$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.6
  • RUBY VERSION: 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux]
@hannahwhy
hannahwhy / output
Created September 13, 2010 17:52
a demonstration of signal(3)
0x0
0x1f2e
dummy handler received 99
@hannahwhy
hannahwhy / failing_run.txt
Created September 29, 2010 22:25
jasmine:ci in Xvfb
$ rake ci:setup:rspec ci:javascripts
(extraneous setup messages elided)
Waiting for jasmine server on 64969...
[2010-10-04 14:37:22] INFO WEBrick 1.3.1
[2010-10-04 14:37:22] INFO ruby 1.8.7 (2010-08-16) [i686-darwin9.8.0]
[2010-10-04 14:37:22] INFO WEBrick::HTTPServer#start: pid=42331 port=64969
Waiting for jasmine server on 64969...
jasmine server started.
@hannahwhy
hannahwhy / exists_with_scope.log
Created October 13, 2010 16:43
exists? with default_scope error (AR >= 2.3.9)
D, [2010-10-13T12:06:16.254575 #16142] DEBUG -- : SQL (0.3ms) select sqlite_version(*)
D, [2010-10-13T12:06:16.255374 #16142] DEBUG -- : SQL (0.5ms) CREATE TABLE "widgets" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "accessory_id" integer)
D, [2010-10-13T12:06:16.255771 #16142] DEBUG -- : SQL (0.1ms) CREATE TABLE "accessories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL)
D, [2010-10-13T12:06:16.271467 #16142] DEBUG -- : SQL (0.1ms) SELECT name
FROM sqlite_master
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
D, [2010-10-13T12:06:16.275491 #16142] DEBUG -- : SQL (0.1ms) INSERT INTO "accessories" VALUES(NULL)
D, [2010-10-13T12:06:16.281336 #16142] DEBUG -- : SQL (0.1ms) INSERT INTO "widgets" ("accessory_id") VALUES (1)
D, [2010-10-13T12:06:16.286909 #16142] DEBUG -- : Widget Load (0.1ms) SELECT "widgets"."id" FROM "widgets" WHERE ("widgets"."accessory_id" = 1) LIMIT 1
@hannahwhy
hannahwhy / test-x-connection.c
Created October 20, 2010 17:05
libxcb leaks like a sieve
#include <X11/Xlib.h>
int main(int argc, char **argv)
{
Display *d;
int ret;
d = XOpenDisplay(argv[1]);
ret = d ? 0 : 1;
#include <stdlib.h>
#include <stdio.h>
#define sizeof(n) ((size_t)(rand() % (sizeof(n) + 1)))
int main(int argc, char **argv)
{
int i;
for(i = 0; i < 100; ++i) {
@hannahwhy
hannahwhy / gist:732391
Created December 7, 2010 20:54
responses.rb:68-81 from rubycas-client 2.2.1
@extra_attributes = {}
@xml.elements.to_a('//cas:authenticationSuccess/*').each do |el|
# generating the hash requires prefixes to be defined, so add all of the namespaces
el.namespaces.each {|k,v| el.add_namespace(k,v)}
@extra_attributes.merge!(Hash.from_xml(el.to_s)) unless (el == cas_user)
end
@extra_attributes.each do |k, v|
if v.blank?
@extra_attributes[k] = nil