Skip to content

Instantly share code, notes, and snippets.

View fowlmouth's full-sized avatar
🦃

Tim E fowlmouth

🦃
  • United States of America
View GitHub Profile
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
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
@fowlmouth
fowlmouth / sdlc.nim
Last active December 13, 2015 20:28
nimrod sdl example using iterators as continuations
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:
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
{
"items":{
"Neutron Bomb": {
"fire": {
"cooldown":90,
"misfire-chance":2,
"energy-cost":300
},
"projectile": {
"fire-angle": 0, //fire from the front
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) =
@fowlmouth
fowlmouth / test.c
Last active December 15, 2015 21:09
#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
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":
@fowlmouth
fowlmouth / SNACK.rb
Last active December 16, 2015 08:08
SNUSP Needed a stACK
%w/gosu ostruct optparse/.each &method(:require)
include Gosu
file = nil
playfieldSize = nil
mode = :SNACK
ipf = 1
font = './LiberationMono-Regular.ttf'
autostart = false
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'