Skip to content

Instantly share code, notes, and snippets.

Adam Weis aweis

View GitHub Profile
module Mem_store = Irmin_mem.KV(Irmin.Contents.String);
let config = Irmin_mem.config();
let repo = Mem_store.Repo.v(config);
open Lwt.Infix;
let master = config => Mem_store.Repo.v(config) >>= Mem_store.master;
let info = msg => {
aweis / mersenne.c
Created Jan 29, 2014
Find all Mersenne Primes in C given enough memory and time
View mersenne.c
#include <stdio.h>
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
isPrime(uintmax_t n) {
if (n < 2) {
return 0;
} else if (n == 2 || n == 3) {
aweis / test.txt
Created Dec 10, 2013
time rake spec on schedule+ on different versions of ruby Awesome speed improvements!
View test.txt
ruby 1.9.3
rake spec 48.14s user 2.45s system 93% cpu 53.839 total
ruby 2.0.0
rake spec 20.33s user 1.90s system 87% cpu 25.432 total
ruby 2.1.0
rake spec 15.70s user 1.88s system 84% cpu 20.804 total
View gist:4238125
* 07da981 - Revert "Pie in the sky, maybe its a bug in precompiled bullshit" (22 hours ago) <Adam Weis>
* 0282d02 - Pie in the sky, maybe its a bug in precompiled bullshit (22 hours ago) <Adam Weis>
aweis / fun.rb
Created Sep 28, 2012
Functional Ruby
View fun.rb
class Array
def tail
head, *tail = self
return tail
def head
head, *tail = self
return head
View gist:85ce138c5d9a777df87e
namespace :manage do
resources :dashboard, :only => [] do
collection do
get 'index'
aweis / unit_test.rb
Last active Aug 29, 2015
timestamps weirdness
View unit_test.rb
#s/ActiveSupport::TestCase/Test::Unit::TestCase works
require 'test_helper'
class ThingTest < ActiveSupport::TestCase
def test_thing
ActiveRecord::Base.uncached do
first = ActiveRecord::Base.connection.query("select now();")
p [, first]
sleep 3
You can’t perform that action at this time.