This file contains hidden or 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
package com.ning.http.client.fancy; | |
import com.ning.http.client.AsyncHttpClient; | |
import com.ning.http.client.Response; | |
import org.apache.log4j.BasicConfigurator; | |
import org.mortbay.jetty.Connector; | |
import org.mortbay.jetty.Handler; | |
import org.mortbay.jetty.Server; | |
import org.mortbay.jetty.handler.AbstractHandler; | |
import org.mortbay.jetty.nio.SelectChannelConnector; |
This file contains hidden or 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
package org.skife.jdbi.v2.unstable.async; | |
import org.skife.jdbi.derby.Tools; | |
import org.skife.jdbi.v2.DBI; | |
import org.skife.jdbi.v2.DBITestCase; | |
import org.skife.jdbi.v2.Handle; | |
import org.skife.jdbi.v2.tweak.HandleCallback; | |
import org.skife.jdbi.v2.util.StringMapper; | |
import java.util.concurrent.CountDownLatch; |
This file contains hidden or 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
// okay java trivia weenies, which asserts pass, which fail? | |
Integer foo = 42; | |
Integer bar = 42; | |
assert foo <= bar; | |
assert foo >= bar; | |
assert foo == bar; | |
foo = 1000; |
This file contains hidden or 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
class Canine | |
VERSION = '1.3' | |
def initialize(&block) | |
@commands = Hash.new | |
@default = @latest = :commands | |
@empty = nil | |
@auto = { | |
:commands => hash_command("commands","Show a list of commands",Proc.new { | |
@commands.each { |cmd| c = cmd[1] | |
name = c[:name].to_s |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'logger' | |
require 'open-uri' | |
begin | |
require 'active_resource' | |
rescue LoadError => e | |
# active_resource has probably been installed via rubygems | |
# which, of course, does not put it on the search path |
This file contains hidden or 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
#!/usr/bin/env ruby | |
class Magic | |
def initialize parents=nil, name=nil, args=nil | |
@args, @path = args, if parents then | |
"#{parents}.#{name}" | |
else | |
name |
This file contains hidden or 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
import java.util.Map; | |
import java.util.LinkedHashMap; | |
public class Collectiony | |
{ | |
public static <T> Map<T, T> LHMap(T... elements) | |
{ | |
LinkedHashMap<T, T> rs = new LinkedHashMap<T, T>(); | |
for (int i = 0; i < elements.length; i += 2) { | |
rs.put(elements[i], elements[1+1]); |
This file contains hidden or 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
HttpExchange exchange = new HttpExchange() { | |
private volatile int count = 0; | |
@Override | |
public InputStream getRequestContentSource() { | |
return new ByteArrayInputStream(new byte[0]); | |
} | |
@Override | |
public Buffer getRequestContentChunk() throws IOException { |
This file contains hidden or 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
brianm@kite:~/src/glitch<master>$ ruby src/ruby/glitch.rb src/ruby/glitch.rb | |
-- | |
src/ruby/glitch.rb:10 : one, brianm | |
should this detect string vs io? | |
-- | |
src/ruby/glitch.rb:22 : one, brianm | |
here it takes an IO, good that the name is different | |
from the module function | |
brianm@kite:~/src/glitch<master>$ |
This file contains hidden or 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
#!/bin/sh | |
exec foo $0 $@ | |
!# |