A ZSH theme optimized for people who use:
- Solarized
- Git
- Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
| #!/usr/bin/env ruby | |
| # twail.rb | |
| # Twitter stream tail | |
| # Copyright 2010 Jonathan Rudenberg | |
| # Licensed under the MIT License | |
| # | |
| # Prerequisites: gem install json twitter-stream | |
| require 'optparse' |
| /** | |
| * REST interface to Akka's JMX service. | |
| * <p/> | |
| * Here is an example that retreives the current number of Actors. | |
| * <pre> | |
| * http://localhost:9998/management | |
| * ?service=service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi | |
| * &component=se.scalablesolutions.akka:type=Stats | |
| * &attribute=counter_NrOfActors | |
| * </pre> |
| # First run from cold JVM | |
| → time buildr clean test | |
| ... | |
| Completed in 47.557s | |
| buildr clean test 60.39s user 4.52s system 129% cpu 50.172 total | |
| # Start nailgun in the background | |
| → jruby --ng-server & | |
| [1] 39845 |
| import com.google.common.base.Predicate; | |
| public class FilterCriteria { | |
| public static Predicate<Item> freeShipping() { | |
| return new Predicate<Item>() { | |
| public boolean apply(Item item) { | |
| return item.getPrice() >= 25 && item.isAvailable(); | |
| } | |
| }; |
| # Prints "[2, 4]" in IRB | |
| [1,2,3,4].select{ |x| x.even? } |
| import com.google.common.base.Predicate; | |
| import com.google.common.collect.Iterables; | |
| import com.google.common.collect.Lists; | |
| public class GuavaEvensFilter { | |
| public static void main (String [] args) | |
| { | |
| // Prints "[2, 4]" | |
| System.out.println( |
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| public class EvensFilter { | |
| public static void main (String [] args) | |
| { | |
| List<Integer> listA = Arrays.asList(1,2,3,4); | |
| List<Integer> listB = new ArrayList<Integer>(); |
| def using(*args, &block) | |
| case args.first | |
| when Hash # Maven hash mapping | |
| using :maven, *args | |
| when Binding # Erb binding | |
| using :erb, *args | |
| when Symbol # Mapping from a method | |
| raise ArgumentError, "Unknown mapping type: #{args.first}" unless respond_to?("#{args.first}_transform", true) | |
| configure(*args, &block) | |
| when Regexp # Mapping using a regular expression |
| def using(*args) | |
| args.pop.each { |key, value| options[key.to_sym] = value } if Hash === args.last | |
| args.each do |name| | |
| if TestFramework.has?(name) | |
| self.framework = name | |
| elsif name == :integration | |
| options[:integration] = true | |
| else | |
| Buildr.application.deprecated "Please replace with using(:#{name}=>true)" | |
| options[name.to_sym] = true |