Skip to content

Instantly share code, notes, and snippets.

View ssoper's full-sized avatar
👨‍💻

Sean Soper ssoper

👨‍💻
View GitHub Profile
$().ready(function() {
// init file upload
var uploadTimer;
var doUpload=$('#upload1').upload({
name: 'file',
method: 'post',
enctype: 'multipart/form-data',
action: '<c:url value="ParseResumeDocumentServlet"/>',
params: {
editorFlag: ""
@ssoper
ssoper / gist:23509
Created November 10, 2008 15:44
Recipe for gluten-free pancakes
1 cup gluten-free whole wheat (i recommend Bob's Red Mill)
2 tsp baking powder
1 tsp salt
1/3 cup shortening
1/4 cup sugar
2 bananas
1/2 tsp lemon extract (or some lemon zest will do)
throw it in your kitchenaid for a few minutes, put it in a greased 8.5" dish, 350F for 55 mins.
@ssoper
ssoper / gist:23866
Created November 11, 2008 14:47
The ghost class! ...spooky
irb(main):001:0> class Foo
irb(main):002:1> def ghost_class
irb(main):003:2> class << self
irb(main):004:3> self
irb(main):005:3> end
irb(main):006:2> end
irb(main):007:1> end
=> nil
irb(main):008:0> bar = Foo.new
@ssoper
ssoper / gist:23867
Created November 11, 2008 14:47
ghost class
irb(main):001:0> class Foo
irb(main):002:1> def ghost_class
irb(main):003:2> class << self
irb(main):004:3> self
irb(main):005:3> end
irb(main):006:2> end
irb(main):007:1> end
=> nil
irb(main):008:0> bar = Foo.new
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
</head>
<body>
<form method="post" action="/taggings/condition">
<div style="margin: 0pt; padding: 0pt;"><input type="hidden" value="put" name="_method"/><input type="hidden" value="0ba2a152cfbbec1054f94333b533d7d79753e635" name="authenticity_token"/></div>
<input type="hidden" value="business_type" name="tagging[on]" id="tagging_on"/>
<select name="tagging[list][]" id="tagging_list" style="display: none;" multiple=""><option selected="selected" value="acne">acne</option>
<option selected="selected" value="vitiligo">vitiligo</option><option value="cancer - bladder" selected="selected">cancer - bladder</option></select><ul class="holder"><li class="bit-box" rel="acne">acne<a class="closebutton" href="#"/></li><li class="bit-box" rel="vitiligo">vitiligo<a class="closebutton" href="#"/></li><li class="bit-box" rel="cancer - bladder">cancer - bladder<a class="closebutton" href="#"/></li><li class=
@ssoper
ssoper / gist:96629
Created April 16, 2009 20:17
All 50 states plus DC
STATES = [
[ "Alabama", "AL" ],
[ "Alaska", "AK" ],
[ "Arizona", "AZ" ],
[ "Arkansas", "AR" ],
[ "California", "CA" ],
[ "Colorado", "CO" ],
[ "Connecticut", "CT" ],
[ "District of Columbia", "DC" ],
[ "Delaware", "DE" ],
@ssoper
ssoper / gist:102873
Created April 28, 2009 01:41
SEOize any url
def slug
slug = title.downcase.gsub(/'s/, '').gsub(/[^[:alnum:]\-\s\_]/, '').split(/[\s\-\_]+/).delete_if { |i| i.empty? }
limit_reached = false
# This ensures only whole words are used
slug = slug.inject('') do |str, token|
new_token = str.length == 0 ? token : "-#{token}"
limit_reached = true if (str.length + new_token.length) > 50
limit_reached ? str : str << new_token
end
module OverwritePayflowAPI
def self.included(base)
base.alias_method_chain :commit, :retry
end
def commit_with_retry(request_body, request_type = nil)
# Payflow Pro purchases by reference have a habit of failing in tests, probably due to speed with which tests are executed.
# This ensures that the purchase is attempted a maximum number of times with a 1-sec sleep in between. This feature can be
# turned off by calling 'disable_ensure_purchase' in your test.
result = commit_without_retry(request_body, request_type)
module OverwritePayflowAPI
def self.included(base)
base.alias_method_chain :commit, :retry
end
def commit_with_retry(request_body, request_type = nil)
# Payflow Pro purchases by reference have a habit of failing in tests, probably due to speed with which tests are executed.
# This ensures that the purchase is attempted a maximum number of times with a 1-sec sleep in between. This feature can be
# turned off by calling 'disable_ensure_purchase' in your test.
result = commit_without_retry(request_body, request_type)
@ssoper
ssoper / gist:129748
Created June 14, 2009 16:53
Add a tint to your UITabBarController
// Add a tint to your UITabBarController
// This goes in your implementation (.m) file
CGRect frame = CGRectMake(0.0, 0.0, tabBarController.view.bounds.size.width, 48);
UIView *v = [[UIView alloc] initWithFrame:frame];
[v setBackgroundColor: [UIColor colorWithRed: 0.078f green: 0.204f blue: 0.369f alpha: 0.99f]];
[v setAlpha:0.4];
[[tabBarController tabBar] insertSubview: v belowSubview: [[[tabBarController tabBar] subviews] objectAtIndex: 0]];
[v release];