Skip to content

Instantly share code, notes, and snippets.

View asaaki's full-sized avatar
🦀
Oh crab!

Christoph Grabo asaaki

🦀
Oh crab!
View GitHub Profile
@asaaki
asaaki / README
Created July 18, 2011 18:50 — forked from peterc/README
testrocket (origin by peterc)
TestRocket is a simple, tiny testing library for Ruby 1.9.
If => in a hash is a "hash rocket", then +-> and --> for tests should be
"test rockets"!
Simple syntax:
+-> { block that should succeed }
--> { block that should fail }
@asaaki
asaaki / config.ru
Created March 8, 2012 00:15
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
# The following lines should come as no surprise. Except by
@asaaki
asaaki / date_util.erl
Last active December 28, 2015 13:19 — forked from zaphar/date_util.erl
-module(date_util).
-compile(export_all).
epoch() ->
now_to_seconds(now())
.
epoch_hires() ->
now_to_seconds_hires(now())
.
=begin
Message Pack vs similar utilities
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
Packing
user system total real
pack: bert 60.850000 0.270000 61.120000 ( 62.003839)
pack: bson 2.750000 0.010000 2.760000 ( 2.799844)
pack: bson (moped) 12.260000 0.030000 12.290000 ( 12.468642)
@asaaki
asaaki / playground.rs
Created January 26, 2018 08:42 — forked from anonymous/playground.rs
Rust code shared from the playground
use std::ops::Deref;
struct StateFn(fn(&mut Machine) -> StateFn);
impl Deref for StateFn {
type Target = fn(&mut Machine) -> StateFn;
fn deref(&self) -> &Self::Target {
&self.0
}
@asaaki
asaaki / README.md
Last active April 23, 2020 13:44 — forked from twooster/README.md
Create scrolling text gifs for Slack

(Forked fork, that works on macos, too)

Makes little scrolly text jiffs in Flywheel colors.

Prerequisites

  • macos: brew install fontconfig imagemagick gifsicle
  • Linux: sudo apt install fontconfig imagemagick gifsicle

Usage

@asaaki
asaaki / containers-and-clone.rs
Last active July 16, 2023 11:50 — forked from rust-play/playground.rs
[rust] How to avoid leaking trait bounds (to avoid such changes to be breaking changes)
// https://rust-lang.github.io/api-guidelines/future-proofing.html
/*
The following traits should never be used in bounds on data structures:
* Clone
*/
#[derive(Clone, Debug)]