Skip to content

Instantly share code, notes, and snippets.

View edsrzf's full-sized avatar

Evan Shaw edsrzf

  • Vend
  • Auckland, New Zealand
View GitHub Profile
@edsrzf
edsrzf / gist:843383
Created February 25, 2011 05:05
Fix doc typos
From c15dece9122aa25831459cfeb5ed110aa5881b7c Mon Sep 17 00:00:00 2001
From: Evan Shaw <edsrzf@gmail.com>
Date: Fri, 25 Feb 2011 17:55:36 +1300
Subject: [PATCH] Fix typo in doc links
---
web/doc/en/bytecode-compiler/generator.markdown | 2 +-
web/doc/en/bytecode-compiler/writer.markdown | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
@edsrzf
edsrzf / gist:938100
Created April 23, 2011 01:23
Untar a tarball with Go
package main
import (
"archive/tar"
"io"
"os"
)
func main() {
f, _ := os.Open("archive.tar")
@edsrzf
edsrzf / gist:1346113
Created November 7, 2011 20:43
Unmarshaling time string with json
type Timestamp int64
func (ts *Timestamp) UnmarshalJSON(data []byte) os.Error {
if len(data) < 2 || data[0] != '"' || data[len(data)-1] != '"' {
return os.NewError("cannot unmarshal non-string into timestamp")
}
data = data[1 : len(data)-1]
t, err := time.Parse(time.RFC3339, string(data))
if err != nil {
return err
@edsrzf
edsrzf / ironmq.js
Created January 16, 2012 21:13
IronMQ with Node.js example
var bs = require('nodestalker'),
client = bs.Client('mq-aws-us-east-1.iron.io:11300');
token = 'my token';
projectId = 'my project ID';
// authenticate
client.put('oauth ' + token + ' ' + projectId);
client.use('queue-name').onSuccess(function(data) {
@edsrzf
edsrzf / bench.rb
Created February 3, 2012 02:10
Queue benchmark
require 'benchmark'
require 'aws'
require 'beanstalk-client'
require 'carrot'
require 'iron_mq'
require_relative 'config.rb'
msg = "a"*1000
From 1fd11bc7e404fa8d0766c855aaa37123114dafe3 Mon Sep 17 00:00:00 2001
From: Evan Shaw <edsrzf@gmail.com>
Date: Fri, 9 Mar 2012 10:45:57 +1300
Subject: [PATCH] Fix select and command sound issues
* Correct the radio button values for CommandSounds and SelectionSounds in
all games.
* When Selection Sounds Frequency is Seldom, play sound 20% of the time
instead of 25% of the time to match the option description.
* When Command Sounds Frequency is Seldom, play a sound only once after
From 4b9cbf6653ae06944d4ab469f362ba6711bbba67 Mon Sep 17 00:00:00 2001
From: Evan Shaw <edsrzf@gmail.com>
Date: Fri, 9 Mar 2012 13:12:15 +1300
Subject: [PATCH] Fix segfault for games with no monk class
When an unarmed character attacked, the engine tried to apply monk bonuses
even when no monk class was available, causing a segfault.
---
gemrb/core/Scriptable/Actor.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From ac5cfa9da4c66efecc2864f96ae0c6e9fa677c01 Mon Sep 17 00:00:00 2001
From: Evan Shaw <edsrzf@gmail.com>
Date: Sat, 10 Mar 2012 10:18:11 +1300
Subject: [PATCH] Only first selected actor speaks on command
Previously all selected actors would speak when given a command, which
made for a noisy experience. Now only the first selected actor speaks.
Don't call CommandActor on TryToAttack.
@edsrzf
edsrzf / batching_queue.rb
Created June 13, 2012 02:40 — forked from treeder/batching_queue.rb
Example of queuing up 100 workloads per task
users = User.all
users.each_slice(100) do |users_slice|
puts "Queueing worker..."
worker = NotificationWorker.new
worker.users = users_slice
# set other attributes that your worker needs to run
worker.queue
end
@edsrzf
edsrzf / readfq.closure.go
Created October 13, 2012 20:08
read fastq go
package main
import (
"bufio"
"bytes"
"compress/bzip2"
"compress/gzip"
"flag"
"fmt"
"io"