My Recent Pastes (53 and counting)
Pastes by Pat Allan (53 and counting)
Below are the 15 most recent pasties by Pat Allan.
July 16, 2008
4:24PM EDT
by Pat Allan
View more (41 lines)
Dear Mr Allan Internet filtering Thank you for your letter dated 4 January 2008 concerning internet service provider (ISP) filtering. I appreciate your concerns relating to this important issue and I apologise for the delay in replying.
June 12, 2008
12:03AM EDT
by Pat Allan
View more (6 lines)
Music is to make your heart swell up, and to make your soul explode. It's to [bring you] back [to] the existential potential of humanity. You go, "Fuck me, I'm alive! I could do anything, I could go anywhere, I could be anything, I could be anyone!"
April 28, 2008
6:20PM EDT
by Pat Allan
View more (8 lines)
class MonitController < ApplicationController layout nil session :off def heartbeat
February 26, 2008
12:14AM EDT
by Pat Allan
View more (19 lines)
def group_by groups = [] inject({}) do |grouped, element| index = yield(element)
February 20, 2008
10:45PM EDT
by Pat Allan
View more (6 lines)
Spec::Rake::SpecTask.new(:rcov) do |t| t.libs << 'lib' t.spec_files = FileList['spec/**/*_spec.rb'] t.rcov = true t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems']
February 20, 2008
8:19PM EDT
by Pat Allan
resizeCell: function(ref, dup) {
dup.style.width = jQuery.css(ref, "width") + "px";
}
February 20, 2008
7:10PM EDT
by Pat Allan
View more (10 lines)
resizeCell: function(ref, dup) {
var fullWidth = ref.offsetWidth;
var innerWidth = 0;
dup.style.width = innerWidth + "px";
February 14, 2008
8:23PM EDT
by Pat Allan
View more (10 lines)
resizeCell: function(ref, dup) {
var fullWidth = ref.offsetWidth;
var innerWidth = 0;
dup.style.width = innerWidth + "px";
February 13, 2008
10:35PM EDT
by Pat Allan
View more (7 lines)
module ActionController class AbstractRequest def is_xml? format.to_sym == :xml end
February 11, 2008
8:05PM EDT
by Pat Allan
View more (13 lines)
class String def clean patterns = [ {:pattern => /[\s+|\/|\\]/, :replacement => '_' }, # replace whitespace and slashes with underscores {:pattern => /[^a-z|0-9|_]/, :replacement => '' }, # remove non alphanumeric/underscore characters
January 21, 2008
5:41AM EDT
by Pat Allan
arr = (1..100).to_a 3.times do arr = arr[0..((arr.length+1)/2)] end
January 21, 2008
5:40AM EDT
by Pat Allan
arr = (1..100).to_a 3.times do arr = arr[0..(arr.length/2)] end
December 19, 2007
11:25PM EDT
by Pat Allan
View more (20 lines)
def self.find_with_fuzzy_keywords(attrs={}) attrs.reject! &:blank? attrs[:keywords] = [] || attrs[:keywords].collect { |word| "%#{word}%" } values = []
December 19, 2007
11:21PM EDT
by Pat Allan
View more (19 lines)
def self.find_with_fuzzy_keywords(attrs={}) attrs.reject! &:blank? attrs[:keywords] = [] || attrs[:keywords].collect { |word| "%#{word}%" } condition_string = (
October 15, 2007
1:49AM EDT
by Pat Allan
View more (20 lines)
# Build list of Mime types for HTTP responses # http://www.iana.org/assignments/media-types/ Mime::Type.register "*/*", :all Mime::Type.register "text/plain", :text, [], %w(txt)
