Skip to content

Instantly share code, notes, and snippets.

View phoet's full-sized avatar
:shipit:
Shippin Stuffs 🚀

Peter Schröder phoet

:shipit:
Shippin Stuffs 🚀
View GitHub Profile
@phoet
phoet / example.rb
Last active November 18, 2020 12:31
translate bug
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", "~> 6.0.3"
@phoet
phoet / example.rb
Last active July 29, 2019 14:58
group by with first
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", '6.0.0.rc2'
@phoet
phoet / iota.rb
Last active February 28, 2019 09:47
IOTA for ruby
# inspired by https://github.com/golang/go/wiki/Iota
module IOTA
class Counter
def initialize(start, increment, max)
@start = start
@times = 0
@increment = increment
@max = max
end
@phoet
phoet / example.rb
Created February 4, 2019 11:18
distinct and include
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", '6.0.0.beta1'
@phoet
phoet / retry.gemspec
Last active October 18, 2018 07:37
Generic Retry Helper
Gem::Specification.new do |s|
s.name = 'retry'
s.version = '0.0.1'
s.platform = Gem::Platform::RUBY
s.author = 'Peter Schröder'
s.email = 'phoetmail@googlemail.com'
s.license = 'MIT'
s.homepage = 'https://gist.github.com/phoet/92767354f7d78a9f8e2985bc29df88c4'
s.description = s.summary = 'retry helper as a gist'
@phoet
phoet / bundler_inline_on_heroku.rb
Last active July 3, 2020 13:04
run a script with bundler/inline on heroku
# 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
phoet / keybase.md
Last active January 23, 2017 20:34
keybase proof

Keybase proof

I hereby claim:

  • I am phoet on github.
  • I am phoet (https://keybase.io/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
phoet / temp_env.rb
Created December 16, 2016 15:52
Helper to have temporary environment variables (ENV), ie for testing.
# 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
phoet / README.md
Last active October 16, 2016 12:33
OSX Noop Keyboard Layout

NOOP Keyboard-Layout

Edit with Ukulele like described here.

Needs restart!

@phoet
phoet / artifacts.py
Created January 19, 2016 13:00 — forked from mat/artifacts.py
Pillow PNG artifacts
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This script reproduces the issue with artifacts when
# handling (semi)transparent PNG files:
# https://github.com/python-pillow/Pillow/issues/1449
# Version used:
#