Skip to content

Instantly share code, notes, and snippets.

l = 4
r = 10
answer = l + r
puts "answer is more than 6" if answer > 6
puts answer
This is a test gist.
#!/usr/bin/env ruby
require 'rubygems'
require 'appscript'
require 'yaml'
module BigType
extend Appscript
def self.show(display_me)
app("Quicksilver").show_large_type(display_me)
#import "GTMSenTestCase.h"
@interface «FILEBASENAMEASIDENTIFIER» : GTMTestCase {
}
@end
@implementation «FILEBASENAMEASIDENTIFIER»
@paulanthonywilson
paulanthonywilson / RecordingUploader.m
Created May 11, 2009 10:00
Hack multipart uploader - from spike.
#import "RecordingUploader.h"
#import "RestConfiguration.h"
@implementation RecordingUploader
-(void)uploadFile:(NSString*)file{
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@:%d/recordings", [RestConfiguration host], [RestConfiguration port]]];
NSData *data = [NSData dataWithContentsOfFile:file];
var el=window.frames[1].document.msgViewer.elements;
for (var i=0; i <el.length; i++){el[i].checked=true;}
@paulanthonywilson
paulanthonywilson / screw_unit_visibility_matcher.js
Created June 1, 2009 15:28
Matcher for element visible - ScrewUnit / blue-ridge
Screw.Matchers["be_visible"] = {
match: function(expected, actual) {
return actual.css('display') != "none"
},
failure_message: function(expected, actual, not) {
return 'expected ' + $.print(actual) + (not ? ' not' : '') + ' to be visible';
}
}
# from http://broadcast.oreilly.com/2008/10/testing-rails-partials.html
class ApplicationController
def _renderizer; render params[:args]; end
end
class ActionController::TestCase # or Test::Unit::TestCase, for Rails <2.0
def render(args); get :_renderizer, :args => args; end
end
function bind_label_hiding(){
$("div.feedback_row label").each(function(index, item){
var field = $("#" + $(item).attr("for"));
field.bind("focus", function(){
$(item).hide();
});
field.bind("blur", function(){
if (jQuery.trim(field.attr("value")) == "") $(item).show();
});
def submit_form_javascript name, path, form_name
submission_js = remote_function(:form=>true,
:loading => visual_effect(:appear, 'spinner'),
:complete => visual_effect(:fade, 'spinner', :duration => 0),
:url=>path,
:html=>{:id=>form_name,
:method=>:get})
submission_js.gsub! 'this', "'##{form_name}'"
javascript_tag "#{name} = function() {#{submission_js}}"
end