Skip to content
View list_filter_collapse.js
(function($){
ListFilterCollapsePrototype = {
bindToggle: function(){
var that = this;
this.$filterTitle.click(function(){
that.$filterContent.slideToggle();
that.$list.toggleClass('filtered');
});
},
init: function(filterEl) {
View 0001-Fix-SortedSet-to-ensure-objects-comparable-with.patch
From 9c168445300c6fda62173d37fbbbffa1a2136e03 Mon Sep 17 00:00:00 2001
From: Aviv Ben-Yosef <aviv.by@gmail.com>
Date: Wed, 8 Jun 2011 11:10:11 +0300
Subject: [PATCH] Fix SortedSet to ensure objects comparable with <=>
Fixes 2 failing specs for SortedSet:
- SortedSet#add takes only values which responds <=>
- SortedSet#initialize takes only values which respond to <=>
---
lib/set.rb | 1 +
View RetrierTest.java
public class RetrierTest {
private static int count = 0;
@Rule public RetryRule rule = new RetryRule();
@Test
@Retry
public void failsFirst() throws Exception {
count++;
assertEquals(2, count);
View cart_dsl.rb
describe 'cart' do
it 'allows discount after purchasing certain amount' do
product = Product.new('Snickers', 3)
cart = Cart.new
6.times { cart << product }
cart.when_buying(product).times(5).get(1).free()
cart.total.should == 5*3
View appserver.rb
name "appserver"
description "An application server"
run_list(%w{
recipe[apache2]
})
View default_node.pp
class default_node {
package { 'apache2':
ensure => installed
}
service { 'apache2':
ensure => true,
enable => true,
require => Package['apache2'],
}
}
View gist:746606
public void bind() {
display.getSaveButton().addClickHandler(
new ClickHandler() {
@Override public void click(ClickEvent e) {
// Magic happens here
}
});
}
View AccountTest.java
public class AccountTest {
@Test public void contains() throws Exception {
SortedSet<Account> set = new TreeSet<Account>(Account.NAME_COMPARATOR);
Account first = new Account("first", 1);
set.add(first);
Account otherFirst = new Account("first", 2);
assertFalse(set.contains(otherFirst));
}
}
View Comparator.java
Comparator<Account> NAME_COMPARATOR = new Comparator<Account>() {
@Override public int compare(Account a1, Account a2) {
if (a1.name == null) {
if (a2.name == null) {
return 0;
}
return -1;
}
return a1.name.compareTo(a2.name);
}
Something went wrong with that request. Please try again.