Skip to content

Instantly share code, notes, and snippets.

Adam Weis aweis

Block or report user

Report or block aweis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View IrminHistory.re
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 => {
View gist:85ce138c5d9a777df87e
routes.rb
namespace :manage do
resources :dashboard, :only => [] do
collection do
get 'index'
end
end
end
@aweis
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 [Time.now, first]
sleep 3
@aweis
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>
int
isPrime(uintmax_t n) {
if (n < 2) {
return 0;
} else if (n == 2 || n == 3) {
@aweis
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
aweis / fun.rb
Created Sep 28, 2012
Functional Ruby
View fun.rb
#metaprogramming
class Array
def tail
head, *tail = self
return tail
end
def head
head, *tail = self
return head
end
You can’t perform that action at this time.