Skip to content

Instantly share code, notes, and snippets.

Shippin Stuffs 🚀

Peter Schröder phoet

View GitHub Profile
phoet / iota.rb
Last active Feb 28, 2019
IOTA for ruby
View iota.rb
# inspired by
module IOTA
class Counter
def initialize(start, increment, max)
@start = start
@times = 0
@increment = increment
@max = max
phoet / example.rb
Created Feb 4, 2019
distinct and include
View example.rb
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
gemfile(true) do
source ""
gem "rails", '6.0.0.beta1'
phoet / retry.gemspec
Last active Oct 18, 2018
Generic Retry Helper
View retry.gemspec do |s| = 'retry'
s.version = '0.0.1'
s.platform = Gem::Platform::RUBY = 'Peter Schröder' = ''
s.license = 'MIT'
s.homepage = ''
s.description = s.summary = 'retry helper as a gist'
phoet / bundler_inline_on_heroku.rb
Last active Mar 22, 2017
run a script with bundler/inline on heroku
View bundler_inline_on_heroku.rb
# heroku expects all gems to be vendored.
# bundler/inline has some quirks that don't play nice with it
# so the best alternative is to just do a fresh install every time, dyno time is cheap!
require 'bundler'
require 'bundler/inline'
if ENV['DYNO']
# on heroku, we don't care about their bundler config!
# alternatively, you could `rm -rf /app/.bundle` the bundler config before loading it
phoet /
Last active Jan 23, 2017
keybase proof

Keybase proof

I hereby claim:

  • I am phoet on github.
  • I am phoet ( on keybase.
  • I have a public key whose fingerprint is 7B53 845B DBA6 25B2 FE4F FA16 09FA 59FF FDB3 84F6

To claim this, I am signing this object:

phoet / temp_env.rb
Created Dec 16, 2016
Helper to have temporary environment variables (ENV), ie for testing.
View temp_env.rb
# In order to make testing of environment variables easier,
# you can use this helper to temporarily change the ENV to something you expect.
# As an example:
# Imagine you have some ENV variable that changes based on the current runtime environment.
# def user_id
# ENV['TEST_USER_ID'].present? ? ENV['TEST_USER_ID'] : session[:user_id]
# end
phoet /
Last active Oct 16, 2016
OSX Noop Keyboard Layout

NOOP Keyboard-Layout

Edit with Ukulele like described here.

Needs restart!

phoet /
Created Jan 19, 2016 — forked from mat/
Pillow PNG artifacts
# -*- coding: utf-8 -*-
# This script reproduces the issue with artifacts when
# handling (semi)transparent PNG files:
# Version used:
phoet / default_start_line.php
Created Mar 18, 2015
single best line of PHP evar
View default_start_line.php
<? goto 💩; die "PHP, die you piece of 💩!"; 💩:
phoet / heroku.rake
Created Feb 26, 2015
heroku GC settings generator for rails
View heroku.rake
namespace :heroku do
desc "generate GC settings"
task gc: [:environment] do
settings = {
RUBY_GC_HEAP_FREE_SLOTS: 600000, # default is 4096,
RUBY_GC_HEAP_GROWTH_FACTOR: 1.25, # default is 1.8,
You can’t perform that action at this time.