This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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 -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(/'/, "''") } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'hpricot' | |
require 'open-uri' | |
module HpricotScraper | |
def self.get_div_contents(url, div) | |
doc = Hpricot(open(url)) | |
result = (doc/"##{div}") | |
return result | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# count non-blank lines in a source file | |
find . .java | grep -v \.svn | xargs cat | sed '/^\s*$/d' | wc -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map propertyMap = BeanUtils.describe(bean); | |
try { | |
for (Object key: propertyMap.keySet()) { | |
propertyMap.get(key).toString(); | |
} | |
} catch (Exception e) { | |
throw new RuntimeException e; | |
} | |
OlderNewer