Skip to content

Instantly share code, notes, and snippets.

View brianm's full-sized avatar
Caffeinating

Brian McCallister brianm

Caffeinating
View GitHub Profile
#!/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
@brianm
brianm / canine.rb
Created December 16, 2009 16:16 — forked from h0rs3r4dish/canine.rb
Clone of Canine
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
// 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;
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;
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;
package com.ning.http.client.fancy;
import com.ning.http.client.AsyncHandler;
import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.HttpResponseBodyPart;
import com.ning.http.client.HttpResponseHeaders;
import com.ning.http.client.HttpResponseStatus;
import com.ning.http.client.Response;
import org.apache.log4j.BasicConfigurator;
import org.mortbay.jetty.Connector;
package org.skife.sand;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Comparator;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.Semaphore;
require 'org-ruby'
module Jekyll
class OrgModeConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /org/i
package org.skife.jdbi.v2.unstable.eod;
import junit.framework.TestCase;
import org.h2.jdbcx.JdbcDataSource;
import org.skife.jdbi.v2.DBI;
import org.skife.jdbi.v2.Handle;
import org.skife.jdbi.v2.Something;
import java.io.Closeable;
import java.util.List;
#!/usr/bin/env ruby
t = <<-EOT
#!/usr/bin/env ruby
if 1+1 == 2
puts "hello world"
end
EOT
# what one liner replaces '.gsub /^\s*/, "' to make this output "win"
s = <<-EOB.gsub /^\s*/, ""