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 TranslationUtility | |
attr_accessor :options | |
def initialize scope_or_object, opts={} | |
@options = { | |
:scope => get_scope(scope_or_object), | |
:raise => true | |
}.merge(opts) | |
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
class EmailTokenizer < StringTokenizer | |
def initialize text | |
super text, /(\s|,|;)+/ | |
end | |
def self.filter array=[] | |
result = [] | |
array.each do |item| | |
result << item.downcase if item =~ /.+@.+/ | |
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
require 'action_view' | |
module ActionView::Template::Handlers | |
class NokogiriBuilder | |
class_attribute :default_format | |
self.default_format = Mime::XML | |
def call template | |
require 'nokogiri' | |
"xml = ::Nokogiri::XML::Builder.new { |xml|" + |
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
[mysqld] | |
max_allowed_packet=128M | |
#innodb_force_recovery=1 | |
# fast import settings | |
key_buffer_size=2G | |
innodb_flush_log_at_trx_commit = 2 | |
innodb_flush_method=O_DSYNC | |
innodb_buffer_pool_size=64M |
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/ruby | |
class BranchList < Struct.new(:name_prefix) | |
require 'set' | |
COMMANDS = { | |
:remote => { | |
:list => 'git remote show origin', | |
:remove => 'git push origin :%s' | |
}, |
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
{ | |
"id":1, | |
"name":"Students" | |
} |
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
[ | |
{ | |
"id":2, | |
"name":"Alumni" | |
}, | |
{ | |
"id":3, | |
"name":"Faculty" | |
}, | |
{ |
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
{ | |
"id":2, | |
"name":"Alumni" | |
} |
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
{ | |
"id":5, | |
"name":"Foreign Exchange" | |
} |
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
/* | |
Copyright (C) Alan Beebe ([email protected]). | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
OlderNewer