Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
ELLIOTTCABLE / Array#to_i.rb
Created August 16, 2008 09:29
Array#to_i - turn a comma-delimited number into an integer
class Array
def to_i
i = 0
numeral = 0
self.reverse.inject(0) do |int, section|
i += 1
int += section * (10 ** numeral)
numeral += section.to_i.to_s.size
int
end
EVE Industrialist Ledger (EVIL)
===============================
Gangs
-----
- Gangs are tracked as a group of players, along with tracking who does what.
For instance, efficiency can be tracked based on how much ISK is hauling and
protecting
- A miner or a gang leader can log a start or end time for said user. Gang
[Sat Aug 16 - 05:08:23] [elliottcable @ Geoffrey] [~/Code/src/rspec/]
-- rake examples --trace
(in /Users/elliottcable/Code/src/rspec)
** Invoke examples (first_time)
** Execute examples
/Users/elliottcable/Code/src/rspec/examples/pure/multi_threaded_behaviour_runner.rb:28: warning: already initialized constant MultiThreadedBehaviourRunner
/Users/elliottcable/Code/src/rspec/lib/spec/extensions/main.rb:78: warning: already initialized constant MostThings
/Users/elliottcable/Code/src/rspec/lib/spec/example/example_group_methods.rb:42:in `eval': wrong argument type Proc (expected Binding) (TypeError)
from /Users/elliottcable/Code/src/rspec/lib/spec/example/example_group_methods.rb:42:in `describe'
from /Users/elliottcable/Code/src/rspec/examples/pure/stack_spec_with_nested_example_groups.rb:11:in `block in <top (required)>'
class Class
def method
end
end
module ::Ncurses
class WindowWrapper
attr_reader :window
attr_accessor :height, :width, :top, :left
def initialize height, width, top, left
@height, @width, @top, @left = height, width, top, left
clear
end
defineServer(id = 'giganews',
hosts = [ 'news.giganews.com:443' ],
username = 'elliottcable',
password = '<snip>',
connections = 20,
antiIdle = 4.5 * 60, # 4 minutes, 30 seconds, 0 to disable
#bindTo = '204.31.33.7', # connect FROM this ip address
// Uses XMLHttpRequest to get a json object from a URI
function JSONHttpRequest(URI, onResponse, method_opt, charset_opt){
var method = method_opt || 'GET';
var charset = charset_opt || 'utf-8';
var request = new XMLHttpRequest();
request.open(method, URI, true);
request.setRequestHeader("Content-Type", "application/json;charset=" + charset);
request.onreadystatechange = function() {
@ELLIOTTCABLE
ELLIOTTCABLE / 1. README.mkdn
Created September 5, 2008 23:34
URL protocol handling in RubyCocoa
public class Exercises {
public static void main(String[] args) {
System.out.println("Test");
}
}
import java.util.Scanner;
import java.lang.Math;
public class Exercises {
static Scanner keyboard = new Scanner(System.in);
public static void main(String[] args) {
System.out.println("I wasn't sure which excercises I was supposed to do, "
+ "so I did all the actual programming ones.");
// Each of these lines will announce an excercise and then run it