Skip to content

Instantly share code, notes, and snippets.

View sevvie's full-sized avatar

sevvie Rose sevvie

View GitHub Profile
@sevvie
sevvie / gist:3317031
Created August 10, 2012 19:17
pegex-cdent
seven@broodmother :: ~/Workspaces/pegex-cdent ‹master*› % make test 2 ↵
mkdir -p lib/Pegex
mkdir -p lib/Pegex/Parser
mkdir -p lib/Pegex/Pegex
mkdir -p lib/Pegex/Grammar
coffee --compile -p src/Pegex/Parser/Indent.coffee > lib/Pegex/Parser/Indent.js
coffee --compile -p src/Pegex/Parser.coffee > lib/Pegex/Parser.js
coffee --compile -p src/Pegex/Pegex/AST.coffee > lib/Pegex/Pegex/AST.js
coffee --compile -p src/Pegex/Pegex/Grammar.coffee > lib/Pegex/Pegex/Grammar.js
coffee --compile -p src/Pegex/Compiler.coffee > lib/Pegex/Compiler.js
@sevvie
sevvie / gameloop.go
Created September 22, 2012 02:25
Useless example in Go, for the $GB
package main
import( "fmt"; "time" )
// type Board
// The game board
type Board struct {
tiles [][]int
}
@sevvie
sevvie / game.go
Created September 23, 2012 04:29
Having fun with Go and the Gracious Benefactor
package doomed
import ("math/rand"; "fmt")
// UGH WHY AM I DOING IT LIKE THIS
const (
Unused = -1
NotGenerated = 0
Mountain = 1
@sevvie
sevvie / game_test.go
Created September 23, 2012 04:30
Tests for "Having Fun with Go and the Gracious Benefactor"
package doomed
import("testing"; "fmt")
func TestNewBoard(t *testing.T) {
b := NewBoard(17, 17)
if len(b.grid) != 17 { t.Errorf("Board size is wrong!") }
}
func TestGenerator(t *testing.T) {
package mapgen
type PerlinNoisePRNG struct {
seed, octaves int
persistence, frequency, amplitude float64
}
func (prng *PerlinNoisePRNG) NoiseAt(x, y float64) float64 {
n := int(y) * 47 + int(x) + prng.seed
n = (n << 13) ^ n
package mapgen
import "testing"
func TestNoiseGenerator(t *testing.T) {
prng := new(PerlinNoisePRNG)
prng.seed = 1
var e float64
for i := 0.0; i < 64; i++ {
for j := 0.0; j < 64; j++ {
{
package Card;
sub new {
my $type = shift;
my $obj = [];
my $args = [@_];
if( ref(\$args->[0]) eq 'SCALAR' ) {
if( $args->[0] eq 'key' ) {
$obj = [$args->[1], $args->[3]];
sevvie@Prudence - ~/Downloads % ping guildwars2.com [0]
PING guildwars2.com (64.25.40.16): 56 data bytes
64 bytes from 64.25.40.16: icmp_seq=0 ttl=112 time=136.137 ms
64 bytes from 64.25.40.16: icmp_seq=0 ttl=112 time=136.543 ms (DUP!)
64 bytes from 64.25.40.16: icmp_seq=0 ttl=112 time=136.551 ms (DUP!)
64 bytes from 64.25.40.16: icmp_seq=0 ttl=112 time=136.575 ms (DUP!)
64 bytes from 64.25.40.16: icmp_seq=1 ttl=112 time=95.445 ms
64 bytes from 64.25.40.16: icmp_seq=1 ttl=112 time=95.829 ms (DUP!)
64 bytes from 64.25.40.16: icmp_seq=1 ttl=112 time=95.849 ms (DUP!)
64 bytes from 64.25.40.16: icmp_seq=1 ttl=112 time=96.232 ms (DUP!)
@sevvie
sevvie / gol-ls.ls
Last active December 16, 2015 19:29
The Game of Life, in LiveScript, by sevvie. See also: https://gist.github.com/sevvie/5431662. Thanks to @Nami-Doc, @gkz, and @audreyt for the pointers!
# Conway's Game of Life, in LiveScript
# ====================================
#
# Conway's Game of Life is a cellular automaton, published by John H Conway
# in 1970, fulfilling the design principles but greatly simplifying the
# research of von Neumann, into a hypothetical machine that could build
# copies of itself. It is a zero-player game, meaning there is no input, and
# the game will progress on its own with a 'seed', or configuration, to
# begin with.
#
@sevvie
sevvie / cmd-line.ls
Last active December 17, 2015 00:29
These five lines of code make me way too happy.
#!env lsc
global <<< require \prelude-ls
cmd-line-args = drop 2, process.argv
console.log cmd-line-args