Skip to content

Instantly share code, notes, and snippets.

View sprsquish's full-sized avatar

Jeff Smick sprsquish

View GitHub Profile
package com.twitter.zipkin.collector
import com.twitter.finagle.stats.StatsReceiver
import com.twitter.server.TwitterServer
import com.twitter.util.{Await, Future}
import com.twitter.zipkin.storage.cassandra.CassieSpanStoreFactory
import com.twitter.zipkin.common.Span
import com.twitter.zipkin.receiver.scribe.ScribeSpanReceiverFactory
import com.twitter.zipkin.storage.WriteSpanStore
import com.twitter.zipkin.zookeeper.ZooKeeperClientFactory
val closeFuture = new Promise[Unit]
val c = new ClientConnection {
def remoteAddress: SocketAddress = null
def localAddress: SocketAddress = null
def onClose: Future[Unit] = closeFuture
def close(deadline: Time): Future[Unit] = {
closeFuture.setDone()
closeFuture
}
}
require "set"
module RakeTask
CALLED = Set.new
NAMESPACES = []
TASKS = Hash.new { |h, k| h[k] = Struct.new(:blocks, :deps).new([], []) }
def self.call(name)
return if CALLED.include?(name)
raise "Unknown task: #{name.inspect}" unless TASKS.key?(name)
/** * @author chuck */
Tumblr = {
addUsername: function(username) { Application.prefs.setValue('tumblr_user_username', username); },
addPassword: function(password) { Application.prefs.setValue('tumblr_user_password', password); },
addGroup: function(group) { Application.prefs.setValue('tumblr_group', group); },
getUsername: function() { return Application.prefs.get('tumblr_user_username').value; },
getPassword: function() { return Application.prefs.get('tumblr_user_password').value; },
getGroup: function() { return Application.prefs.get('tumblr_group').value; },
@sprsquish
sprsquish / gist:12739
Created September 25, 2008 02:49
Concerned With by Rick Olson
## Concerned With by Rick Olson
class << ActiveRecord::Base
def concerned_with(*concerns)
concerns.each do |concern|
require_dependency "#{name.underscore}/#{concern}"
end
end
end
require 'blather/client'
class Echo < Blather::Client
def receive_message(msg)
send_data msg.reply! if msg.type == :chat
end
end
Blather.run 'echo@jabber.local', 'echo', Echo.new
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), %w[.. lib])
require 'blather/client'
if ARGV.length != 2
puts "Run with ./echo.rb user@server/resource password"
exit 1
end
class Foo
def bar
end
private
def baz
end
end
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "☠"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
(function($) {
$.fn.tweet = function(o){
var s = {
username: ["seaofclouds"], // [string] required, unless you want to display our tweets. :) it can be an array, just do ["username1","username2","etc"]
avatar_size: null, // [integer] height and width of avatar if displayed (48px max)
count: 3, // [integer] how many tweets to display?
intro_text: null, // [string] do you want text BEFORE your your tweets?
outro_text: null, // [string] do you want text AFTER your tweets?
join_text: null, // [string] optional text in between date and tweet, try setting to "auto"