Skip to content

Instantly share code, notes, and snippets.

View arockwell's full-sized avatar

Alex Rockwell arockwell

View GitHub Profile
var tabSet = $('ul.navTabs').eq(0).tabs(
{ /* apply a nice visual effect to tab activation */
fx: { height: 'toggle', opacity: 'toggle' },
/* disable all but the first tab by default */
disabled: [1,2,3,4]
}).bind('select.ui-tabs', function(event, ui) {
/* ensure that each time a new tab is activated
all subsequent tabs are disabled. This will
prevent users from jumping around in the process
*/
//bind the form and provide a callback function
$('#sform').submit(function() {
//submit the form via ajax
$(this).ajaxSubmit({
target: '#billingDetails',
url: 'checkout3-fragment.html',
success: function() {
var tabSet = $('ul.navTabs');
tabSet.tabs("enable", 2);
tabSet.tabs("select", 2);
-module(tut15).
-export([start/0, ping/2, pong/0]).
ping(0, Pong_PID) ->
Pong_PID ! finished,
io:format("ping finished~n", []);
ping(N, Pong_PID) ->
Pong_PID ! {ping, self()},
receive
pong ->
module FileReader
def self.output(filename, delimeter, table_name, column_names)
result = Array.new
File.open(filename).each do |line|
# split the line on commas and remove trailing white space
columns = line.split(delimeter).each {|x| x.strip!}
# escape ' characters
columns.map! { |x| x.gsub(/'/, "''") }
# bowling_spec.rb
require 'bowling'
describe Bowling do
before(:each) do
@bowling = Bowling.new
end
it "should score 0 for gutter game" do
20.times { @bowling.hit(0) }
require 'hpricot'
require 'open-uri'
module HpricotScraper
def self.get_div_contents(url, div)
doc = Hpricot(open(url))
result = (doc/"##{div}")
return result
end
# count non-blank lines in a source file
find . .java | grep -v \.svn | xargs cat | sed '/^\s*$/d' | wc -l
public interface HousingHibernateTemplate {
public void execute(HousingHibernateCallback callback) throws HibernateException;
public <T> T find(Class<T> clazz, HousingHibernateCallback callback);
public <T> List<T> findList(Class<T> clazz, HousingHibernateCallback callback) throws HibernateException;
}
private List<String> findRoles(final String username) {
List<String> roleNames = new ArrayList<String>();
try {
Context context = new InitialContext();
HousingIdentityService identityService =
(HousingIdentityService) context.lookup("java:comp/env/ejb/HousingIdentityServiceImpl/local");
roleNames = identityService.getRoles(username);
} catch (Exception e) {
logger.error("Problem retrieving roles: " + e.getMessage());
throw new RuntimeException(e);
Map propertyMap = BeanUtils.describe(bean);
try {
for (Object key: propertyMap.keySet()) {
propertyMap.get(key).toString();
}
} catch (Exception e) {
throw new RuntimeException e;
}