Skip to content

Instantly share code, notes, and snippets.

View mikeymicrophone's full-sized avatar

Mike Schwab mikeymicrophone

View GitHub Profile
task :babygitter_report, :roles => :app do
require '../vendor/plugins/babygitter/babygitter'
BabyGitter::ReportGenerator.new.write_report
end
package quickcompare;
public class Beta {
public float[] baseline;
public float[] security;
public double[] dailyMovement(float[] series) {
int i;
double[] percentChange = new double[series.length];
# A sometimes useful development utility
class Nop < BlankSlate
def self.null
new {}
end
def self.void
new {throw :skip}
end
var in_subnav = false;
function nap (m) {var then = new Date(new Date().getTime() + m); while (new Date() < then) {}}
$(document).ready(function() {
$('#navigation .baseball').mouseenter( function() {
$('#baseball-regions').attr('style', 'left:50px;');
});
$('#baseball-regions a:contains(\'Northeast\')').mouseenter( function() {
$('#northeast-areas').attr('style', 'left:100px;');
$('#southeast-areas').attr('style', 'left:-500px;');
});
require 'http_require'
require 'http://github.com/why/camping/raw/master/lib/camping.rb'
# a testing utility by Mike Harris
class PersistantHash
def [](k)
f = File.dirname(__FILE__) + "/phash/#{k}"
if File.exists?(f)
File.open(f) { |x| Marshal.load(x) }
else
nil
# to start at the beginning and walk through the revisions, use these links -------------------
#|
class Slapper #|
def slap #|
before_slap #|---->
puts "I just slapped something"
end
def before_slap
end
NSString *plist_path = [NSHomeDirectory() stringByAppendingPathComponent:@"audio_recording_number.plist"];
NSLog(@"plist path: %@", plist_path);
NSLog(@"file exists: %i", [[NSFileManager defaultManager] fileExistsAtPath:plist_path]);
if ([[NSFileManager defaultManager] fileExistsAtPath:plist_path]) {
NSLog(@"found audio config file");
} else {
NSLog(@"did not find audio config file");
audio_recording_number = [NSNumber numberWithInteger:0];
NSDictionary *audio_properties = [NSDictionary dictionaryWithObject:audio_recording_number forKey:@"number_of_recordings"];
NSArray *comments;
@try {
comments = [self allFromXMLData:res.body];
}
@catch (NSRangeException *e) {
comments = [NSArray array];
}
@catch (NSException *e) {
comments = [NSArray array];
}
class CommentsController
def index
@comments = if params[:book_id]
@scope_object = Book.find(params[:book_id])
@scope_object.comments
elsif params[:article_id]
@scope_object = Article.find(params[:article_id])
@scope_object.comments
else
Comment.all