This file contains hidden or 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
name: Stefan Nuxoll | |
age: 17 |
This file contains hidden or 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 'ruby-event' | |
# General purpose wrapper for network connections | |
class NetworkConnection | |
attr_reader :hostname, :port, :thread | |
# Create a new event to be fired when we recieve data | |
# from the server | |
event :data_received | |
This file contains hidden or 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 'network_connection' | |
conn = NetworkConnection.new('irc.freenode.net', 6667) | |
# Create a new handler for the event | |
conn.data_received + lambda do |server, text| | |
if text =~ /^PING/ | |
server.send(text.gsub(/^PING/, "PONG")) | |
end | |
end |
This file contains hidden or 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
module YCombinator | |
def y_comb(&generator) | |
proc { |x| | |
proc { |*args| | |
generator.call(x.call(x)).call(*args) | |
} | |
}.call(proc { |x| | |
proc { |*args| | |
generator.call(x.call(x)).call(*args) | |
} |
This file contains hidden or 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 | |
total = 0 | |
STDIN.each_line do |line| | |
total += line.split(" ").inject(0) { |sum, x| sum + x.to_i } | |
end | |
puts "GRAND TOTAL: #{total}" |
This file contains hidden or 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
using GLib; | |
namespace snuxoll { | |
class StdinReader : Object { | |
public StdinReader () { | |
} | |
public bool eof() { |
This file contains hidden or 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
to compile: | |
valac -o sum --pkg vala-1.0 stdin_reader.vala sum_application.vala |
This file contains hidden or 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 'ftools' | |
require "vala" | |
require "pkg_config" | |
require "source_modules" | |
desc "Compile droppit" | |
task :default => [:build] | |
task :build => [:check_deps, :droppit] | |
desc "Regenerate code and build" | |
task :rebuild => [:generate, :build] |
This file contains hidden or 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
using GLib; | |
namespace SoupServer { | |
class ServerApplication : Object { | |
private Soup.Server server; | |
public ServerApplication() { | |
server = new Soup.Server(Soup.SERVER_PORT, 8000, null); |
This file contains hidden or 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
module Shop | |
module Config | |
LDAP_HOST = ENV["LDAP_HOST"] | |
LDAP_BIND_DN = ENV["LDAP_BIND_DN"] | |
LDAP_BIND_PASS = ENV["LDAP_BIND_PASS"] | |
LDAP_SEARCH_BASE = ENV["LDAP_SEARCH_BASE"] | |
LDAP_SEARCH_PROPERTY = ENV["LDAP_SEARCH_PROPERTY"] | |
LDAP_SECURITY_GROUP = ENV["LDAP_SECURITY_GROUP"] | |
end | |