Skip to content

Instantly share code, notes, and snippets.

View danopia's full-sized avatar

Daniel Lamando danopia

View GitHub Profile
#include "LinkedList.h"
template <class T>
LinkedList<T>::LinkedList()
{
first = NULL;
last = NULL;
}
template <class T>
ArgumentsStruct: cover {
val1: String
val2: Int
}
Arguments: cover from ArgumentsStruct* {
new: static func -> This {
gc_malloc(Arguments size) as This
}
require 'socket'
s=TCPSocket.new *ARGV[0,2]
s.puts "USER A B C D
NICK waffles"
until s.eof?
s.puts case s.gets
when /^\S+ 001 /
"JOIN "+ARGV[2]
when /.+ :-quit( .+)?/
"QUIT :#{$1}"
run proc({|env| [200, {'Content-Type' => 'text/plain'}, env.map{|k, v| "#{k.rjust(20)} = #{v}\n" }.join] })
module EventMachine
module Protocols
module JsonProtocol
def post_init
@parser = Yajl::Parser.new
@parser.on_parse_complete = method(:receive_object)
@encoder = Yajl::Encoder.new
end
def receive_data(data)
@danopia
danopia / dupes.rb
Created November 18, 2009 01:20 — forked from ldunn/dupes.rb
#!/usr/bin/env ruby
require 'digest/md5'
require 'find'
@hashfun = Digest::MD5.new
@digests = {}
def digest filename
@hashfun.hexdigest File.read(filename)
def create
@bit = Bit.new(params[:bit])
@bit.IP = request.remote_ip
respond_to do |format|
if @bit.save
flash[:notice] = 'Bit was successfully created.'
#cookies[:bitbin] = { :value => @bit.id.to_i, :expires => Time.now + 3600}
format.html { redirect_to(@bit) }
format.xml { render :xml => @bit, :status => :created, :location => @bit }