This file contains 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 | |
# http://kdpeterson.net | |
# Copyright (c) 2009 Kevin Dempsey Peterson | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains 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 Mention | |
attr_accessor :topic, :prominence, :topic_sentiment, :other_sentiment | |
def initialize(topic, prominence, topic_sentiment, other_sentiment) | |
@topic = topic | |
@prominence = prominence | |
if(topic == "Apples") | |
topic_sentiment = topic_sentiment ** 3 | |
elsif topic == "Bananas" | |
topic_sentiment = Math.sqrt topic_sentiment | |
end |
This file contains 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
<?php | |
# Nucleus legacy incoming links redirect script | |
# see blog post at http://kdpeterson.net/blog/ for explanation | |
$items = array( | |
"27" => "2007/05/1846-the-murder-of-jose-de-los-reyes-berreyesa-and-the-twin-brothers-named-haro-by-a-group-of-bear-f.html", | |
"43" => "2008/03/the-widescreen-rip-off-11-less-for-the-same-price.html", | |
"45" => "2008/03/changing-location-url-of-svn-repository-in-eclipse-1.html", | |
"46" => "", |
This file contains 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
<?php | |
# Nucleus legacy incoming links redirect script | |
# see blog post at http://kdpeterson.net/blog/ for explanation | |
$host = $_SERVER['HTTP_HOST']; | |
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: http://$host$uri/atom.xml"); | |
?> |
This file contains 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.apache.hadoop.hbase.client.tableindexed; | |
import java.io.DataInput; | |
import java.io.DataOutput; | |
import java.io.IOException; | |
import java.util.Map; | |
import org.apache.hadoop.hbase.util.Bytes; | |
/** |
This file contains 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/ruby | |
require 'rubygems' | |
require 'hbase' | |
transport = Thrift::BufferedTransport.new(Thrift::Socket.new('127.0.0.1', 9090)) | |
protocol = Thrift::BinaryProtocol.new(transport) | |
client = Apache::Hadoop::Hbase::Thrift::Hbase::Client.new(protocol) | |
transport.open |
This file contains 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
# Return a timestamp from an HBase cell | |
# [cell] the cell itself or its contents | |
def self.time_from_hbase(cell) | |
# unpack 8 bytes in network (big endian) byte order | |
if cell.respond_to? :value | |
a = cell.value | |
else | |
a = cell | |
end | |
halves = a.unpack "NN" |
This file contains 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/ruby | |
require 'rubygems' | |
require 'redis' | |
REDIS_CMD = "./redis-server" | |
DIR = "redis-repl-test" | |
FileUtils.mkdir(DIR) unless File.directory?(DIR) | |
class Redis |
This file contains 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
require 'formula' | |
class Emacs < Formula | |
url 'http://ftp.gnu.org/pub/gnu/emacs/emacs-23.3a.tar.bz2' | |
md5 'f2cf8dc6f28f8ae59bc695b4ddda339c' | |
homepage 'http://www.gnu.org/software/emacs/' | |
if ARGV.include? "--use-git-head" | |
head 'git://repo.or.cz/emacs.git' | |
else |
This file contains 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
public class Nullery { | |
private static MockObjectNamingScheme namingScheme = new CamelCaseNamingScheme(); | |
private static Imposteriser imposteriser = ClassImposteriser.INSTANCE; | |
public static <T> T nulled(Class<T> typeToNull) { | |
return nulled(typeToNull, namingScheme.defaultNameFor(typeToNull)); | |
} | |
public static <T> T nulled(Class<T> typeToMock, final String name) { |
OlderNewer