Skip to content

Instantly share code, notes, and snippets.

View itsderek23's full-sized avatar

Derek Haynes itsderek23

View GitHub Profile
/usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/filter/timespan.rb:35:in `<=': comparison of Fixnum with nil failed (ArgumentError)
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/filter/timespan.rb:35:in `filter'
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/controller.rb:291:in `filter_request'
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/controller.rb:290:in `each'
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/controller.rb:290:in `filter_request'
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/controller.rb:322:in `run!'
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/source/log_parser.rb:272:in `handle_request'
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_
class File
alias_method :gets_original, :gets
# The size of the reads we will use to add to the line buffer.
MAX_READ_SIZE=1024*100
#
# This method returns the next line of the File.
#
# It works by moving the file pointer forward +MAX_READ_SIZE+ at a time,
# storing seen lines in <tt>@line_buffer</tt>. Once the buffer contains at
@itsderek23
itsderek23 / gist:582635
Created September 16, 2010 15:37
Sample Raplet Rails Controller Action
def raplet
html=""
email=params[:email]
if retrieve_user
html=render_to_string :layout=>false
end
res={:html=>html,:status=>200, :css=>'a{color:blue} ul{padding-left:20px;margin:4px 0;} link{color:blue;cursor:hand}', :js=>"$('.details-link').click(function(){ $('#'+this.id.replace('l','a')).toggle()})"}
render :text=>params[:callback]+"("+res.to_json+")"
end
@itsderek23
itsderek23 / gist:1125365
Created August 4, 2011 15:01
Objective-C - Stripping New Lines
NSString *string = @"Lion says:\nRoar!\nGrowl!";
NSMutableString *mstring = [NSMutableString stringWithString:string];
NSLog(@"before: %@",mstring);
NSRange wholeShebang = NSMakeRange(0, [mstring length]);
[mstring replaceOccurrencesOfString: @"\n"
withString: @""
options: 0
range: wholeShebang];
string = "Lion says:\nRoar!\nGrowl!"
string.gsub("\n",'')
NSString *appName = @"Redwood: ";
NSString *tagline = @"OSX Spotlight for the cloud.";
NSString *message = [appName stringByAppendingString:tagline];
app_name = "Redwood: "
tagline = "OSX Spotlight for the cloud."
message = app_name + tagline
@interface Lion : NSObject {
}
@itsderek23
itsderek23 / Lion.h
Created August 4, 2011 16:12
Lion.h
@interface Lion : NSObject {
int age;
}
@property(readwrite, assign) int age;
@end
@implementation Lion
@synthesize age;
@end