Skip to content

Instantly share code, notes, and snippets.

View splattael's full-sized avatar
🏠
Working from home

Peter Leitzen splattael

🏠
Working from home
View GitHub Profile
#!/usr/bin/ruby
gem "http"
require "http"
require "json"
ARGV.size == 3 or abort "usage: #$0 username github_token start-date"
USERNAME, TOKEN, START_DATE = *ARGV
@splattael
splattael / bug.cr
Last active January 10, 2018 21:09
Strange macro expansions
class Bug
macro my_method(name)
{{ yield }}
end
def counter
@counter ||= Hash(Symbol, Int32).new { |hash, key| hash[key] = 0 }
end
def run
module ROM
end
require "dry/struct"
require "dry/types"
require "rom-factory"
module Types
include Dry::Types.module
end
@splattael
splattael / create_bundler_setup.rb
Created May 29, 2017 17:11
Create bundler setup file. Similar what `bundle --standalone` does.
require "bundler"
class BundlerSetup
def initialize(gemfile)
@gemfile = gemfile
@lockfile = "#{gemfile}.lock"
end
def run(io)
Dir.chdir(File.dirname(@gemfile)) do
#!/bin/bash
# Touches changed files in order to make it work
# on Docker and Windows.
#
# Usage: bin/touch_changed [<sleep every>]
EVERY=${1:-1}
RELOAD="tmp/reload"
@splattael
splattael / keybase
Last active December 10, 2017 10:48
### Keybase proof
I hereby claim:
* I am splattael on github.
* I am splattael (https://keybase.io/splattael) on keybase.
* I have a public key ASAOivkHiHFETTHI-uL5oBlmsPXZQ2nZRmVHL_Do7TpmUgo
To claim this, I am signing this object:
@splattael
splattael / .gitlab-ci.yml
Created December 13, 2016 15:20
Testing Crystal on GitLab CI
variables:
DEBIAN_FRONTEND: noninteractive
APT_PACKAGES: libgc-dev libpcre3-dev libevent-dev
cache:
key: "crystal"
paths:
- .crystal
.test-crystal: &test-crystal
@splattael
splattael / inline.rb
Created November 17, 2016 06:47
dry memory allocations
require "bundler/inline"
gem "dry-types"
gem "dry-struct"
gem "allocation_tracer"
require "dry-types"
require "dry-struct"
module Types
@splattael
splattael / touch_changed
Created June 1, 2016 13:46
Makes middleman work on Docker on Windows!
#!/bin/bash
# Touches changed files in order to make it work
# on Docker and Windows.
#
# Usage: bin/touch_changed [<sleep every>]
EVERY=${1:-1}
RELOAD="tmp/reload"
Error in ./foo.cr:22: undefined method 'uid' for Nil (compile-time type is Rank?)
p list.by("foo").uid
^~~
================================================================================
Nil trace:
./foo.cr:13