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
import irc, re, tables, macros, macro_dsl | |
var | |
commands = initTable[string, proc(event: var TircEvent; | |
args: string){.closure.}]() | |
handlers: seq[tuple[ | |
pattern: TRegex; | |
match: proc(event: var TircEvent; args: var openarray[string]){. | |
closure.}]] = @[] | |
matchPattern: TRegex |
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'parslet' | |
require'parslet/convenience' | |
require'pry' | |
class P < Parslet::Parser | |
def join rule, on, min = 0 | |
rule >> (on >> rule).repeat(min) | |
end | |
root :type |
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
import sdl, sdl_gfx | |
discard sdl.init(INIT_EVERYTHING) | |
var screen = setvideomode(800,600,16,SWSURFACE) | |
iterator checkEvent {.closure.} = | |
var event_t: sdl.TEvent | |
var event = addr event_t | |
while true: | |
if sdl.pollEvent(event) > 0: |
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
import opengl, os, math | |
discard """ | |
Saffron is a Nimrod adapatation of the Simple and Fast Multimedia Library by | |
Laurent Gomila. | |
SFML - Copyright (c) 2007-2008 Laurent Gomila | |
This software is provided 'as-is', without any express or |
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
{ | |
"items":{ | |
"Neutron Bomb": { | |
"fire": { | |
"cooldown":90, | |
"misfire-chance":2, | |
"energy-cost":300 | |
}, | |
"projectile": { | |
"fire-angle": 0, //fire from the front |
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
from strutils import join | |
type | |
TFoo * = object | |
id: int | |
func: proc(){.closure.} | |
var foo_counter = 0 | |
var alive_foos = newseq[int](0) | |
proc free*(some: ref TFoo) = |
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
#include <stdio.h> | |
#define BEGIN { | |
#define END } | |
#define SOME_NUMBER 42 | |
int main(int argc, char *argv[]) BEGIN | |
printf("arg count is %i\n", argc); | |
printf("some number is %i\n", SOME_NUMBER); | |
return 0; | |
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
import parseopt, macros | |
import macro_dsl | |
macro parseOptions*(body: stmt): stmt {.immediate.}= | |
body.expectKind nnkStmtList | |
var opts = newSeq[tuple[flags:seq[string], body:PNimrodNode]](0) | |
for i in 0 .. <len(body): | |
let n = body[i] | |
if n.kind == nnkCommand and $n[0] == "on": |
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
%w/gosu ostruct optparse/.each &method(:require) | |
include Gosu | |
file = nil | |
playfieldSize = nil | |
mode = :SNACK | |
ipf = 1 | |
font = './LiberationMono-Regular.ttf' | |
autostart = false |
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'open-uri' | |
require'nokogiri' | |
URL = 'http://%{city}.craigslist.org/search/%{section}?zoomToPosting=&query=%{query}&srchType=T&minAsk=&maxAsk=' | |
Entry = Struct.new(:name, :link, :age, :location) | |
def get(opts={}) | |
opts = { | |
query: 'w4m', city: 'stlouis', | |
section: 'cas' |