Skip to content

Instantly share code, notes, and snippets.

View AzureKitsune's full-sized avatar

Alex AzureKitsune

  • 04:19 (UTC -05:00)
View GitHub Profile
#!/usr/bin/env ruby
require 'socket'
# http://railsforum.com/viewtopic.php?id=10057 for string extension below
class String
def starts_with?(characters)
self.match(/^#{characters}/) ? true : false
end
end
@AzureKitsune
AzureKitsune / NimEE.nim
Created July 23, 2011 18:33
NimEE (inspired by PyEE) and my functional nimrod file.
#
#
# Nimrod's Runtime Library
# (c) Copyright 2010 Amrykid
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
##
import sequtils
@AzureKitsune
AzureKitsune / log.nim
Created July 26, 2011 14:55
A Logger for Nimrod
import events
import streams
import os
import times
type
TFormatEnum* = enum
file = 1, socket = 2, other = 3
TLogger = object of TObject
@AzureKitsune
AzureKitsune / parallel.nim
Created July 28, 2011 01:41
Nimrod thread enhancements
#
#
# Nimrod's Runtime Library
# (c) Copyright 2011 Alex Mitchell
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
## :Author: Alex Mitchell
import strutils
# CONST
const
loc = "<locale.h>"
winnls = "Winnls.h"
stdlib = "<stdlib.h>"
# FUNCTIONS RELATED TO GETTING LOCALE NAME
when defined(windows):
@AzureKitsune
AzureKitsune / LocaleData.cfg
Last active September 26, 2015 17:38
Localization support for Nimrod
SectionLang = en
[Hello]
es = "Hola"
de = "Hallo"
import events
import sockets
import strutils
type
TMessageReceivedEventArgs = object of TEventArgs
Nick*: string
Message*: string
TIRC = object
EventEmitter: TEventEmitter
import events
import sockets
import strutils
import os
type
TMessageReceivedEventArgs = object of TEventArgs
Nick*: string
Message*: string
TIRC = object
@AzureKitsune
AzureKitsune / IRCBot.cs
Created October 26, 2011 21:36
AccelIRC.. ideas
public abstract class IRCBot
{
public abstract IEnumerable<string> OnChannelMessage(string channel, string msg);
}
public class MyIRCBot : IRCBot
{
public IEnumerable<string> OnChannelMessage(string channel, string msg)
{
yield "Send a message to the channel.";
yield "Another message sent.";
import os
type
TUtf16Char = distinct int16
WideCString = ptr array[0.. 1_000_000, TUtf16Char]
const
utf8Encoding = 65001
proc len(w: WideCString): int =