Skip to content

Instantly share code, notes, and snippets.

View itsbth's full-sized avatar

Bjørn Tore Håvie itsbth

View GitHub Profile
@itsbth
itsbth / test.txt
Created January 6, 2012 16:17
Uploaded by UploadToGist for Sublime Text 2
Foo = 1;
Bar = ("Hello, \"World!\"");
@itsbth
itsbth / grammar.coffee
Created January 6, 2012 19:10
Uploaded by UploadToGist for Sublime Text 2
{Parser} = require 'jison'
# Stolen from coffee-script
# Since we're going to be wrapped in a function by Jison in any case, if our
# action immediately returns a value, we can optimize by removing the function
# wrapper and just returning the value directly.
unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/
# Our handy DSL for Jison grammar generation, thanks to
@itsbth
itsbth / grammar.coffee
Created January 6, 2012 19:29
Uploaded by UploadToGist for Sublime Text 2
{Parser} = require 'jison'
# Stolen from coffee-script
# Since we're going to be wrapped in a function by Jison in any case, if our
# action immediately returns a value, we can optimize by removing the function
# wrapper and just returning the value directly.
unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/
# Our handy DSL for Jison grammar generation, thanks to
@itsbth
itsbth / grammar.coffee
Created January 6, 2012 22:24
Uploaded by UploadToGist for Sublime Text 2
{Parser} = require 'jison'
# Stolen from coffee-script
# Since we're going to be wrapped in a function by Jison in any case, if our
# action immediately returns a value, we can optimize by removing the function
# wrapper and just returning the value directly.
unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/
# Our handy DSL for Jison grammar generation, thanks to
@itsbth
itsbth / grammar.coffee
Created January 8, 2012 21:28
Uploaded by UploadToGist for Sublime Text 2
{Parser} = require 'jison'
# Stolen from coffee-script
# Since we're going to be wrapped in a function by Jison in any case, if our
# action immediately returns a value, we can optimize by removing the function
# wrapper and just returning the value directly.
unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/
# Our handy DSL for Jison grammar generation, thanks to
@itsbth
itsbth / stack1k.c
Created January 9, 2012 17:26
Uploaded by UploadToGist for Sublime Text 2
#include <malloc.h>
#include <alloca.h>
#include <stdio.h>
#include <sys/resource.h>
size_t sizzle;
void recurse(int i) {
char *foo = alloca(sizzle);
foo[sizzle - 1] = 0;
@itsbth
itsbth / xor.cs
Created January 14, 2012 16:53
Uploaded by UploadToGist for Sublime Text 2
using System.Linq;
class FuskareCannotIntoEncryption {
static void Main() {
var pw = System.Text.Encoding.UTF8.GetBytes("hunter2");
var key = System.Text.Encoding.UTF8.GetBytes("this is a a key");
var dat = pw.Select((c, i) => (byte)(c ^ (i % key.Length))).ToArray<byte>();
var ot = System.Convert.ToBase64String(dat);
System.Console.WriteLine(ot);
var it = System.Convert.FromBase64String(ot);
@itsbth
itsbth / Guardfile
Created January 18, 2012 18:20
Uploaded by UploadToGist for Sublime Text 2
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'bundler' do
watch('Gemfile')
# Uncomment next line if Gemfile contain `gemspec' command
# watch(/^.+\.gemspec/)
end
guard 'migrate' do
@itsbth
itsbth / new_dupe_form_spec.rb
Created January 18, 2012 20:17
Uploaded by UploadToGist for Sublime Text 2
describe DupesController, js: true do
def login
visit "/auth/steam"
end
context "#new" do
it "should show a preview" do
login
visit new_dupe_path
within "#new_dupe" do
fill_in 'dupe_description', with: <<-TEXT
commit 8436a1ace5a7b8d20d42f09e24b41c1adbc9591c
Author: Bjørn Tore Håvie <itsbth@itsbth.com>
Date: Fri Jan 20 22:50:04 2012 +0100
Removed redis db, started working on cucumber features, various other changes.
commit 44a1d491c7a9bf3ae5b7de8e33a30b8ce3f8faa2
Author: Bjørn Tore Håvie <itsbth@itsbth.com>
Date: Wed Jan 18 19:49:33 2012 +0100