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 / 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:
#
@phoet
phoet / readme.md
Last active December 30, 2015 06:59
Nexus 5 pros/cons

Nexus 5 usage report (Jan 2014)

I just switched from iPhone 5 to a Nexus 5 32GB for 399€ from the Google Play Store.

I used the Nexus for about a month now and I am pretty impressed.

It's a lot of phone for the price.

Pros:

@phoet
phoet / pdf_support.rb
Created October 25, 2013 12:14
RSpec PDF content matcher
module PDF
class Loader
def self.content_for(body)
temp_pdf = Tempfile.new('pdf')
temp_pdf << body.force_encoding('UTF-8')
temp_pdf.close
receiver = PDF::SimplePageTextReceiver.new
PDF::Reader.file(temp_pdf.path, receiver)
receiver.content
@phoet
phoet / geocoder_stub.rb
Created October 16, 2013 15:15
example for stubbing geocoder calls
require 'geocoder'
Geocoder.configure(:lookup => :test)
Geocoder::Lookup::Test.add_stub(
"Nantes, France", [
{
'latitude' => 47.218371,
'longitude' => -1.553621,
'address' => '4 Rue de la Commune, 44000 Nantes, France',
'state' => 'Pays de la Loire',
@phoet
phoet / menu.rb
Created October 15, 2013 07:52
curses example drawing a menu
require "curses"
include Curses
init_screen
start_color
noecho
def draw_menu(menu, active_index=nil)
4.times do |i|
menu.setpos(i + 1, 1)
unless File.exists?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
@phoet
phoet / readme.md
Last active December 24, 2015 07:19
i am stupid and lazy, RubyMotion to the rescue!

responding to this conversation on twitter: https://twitter.com/phoet/status/383552370015485952

it would be awesome if the RubyMotion toolchain would help me fail fast when submitting stuff to apple.

i have had several issue when doing this in the past:

  • i used an ad_hoc profile for distrubition (don't know if it's possible to know from the certificate)
  • info_plist entries were empty
  • CFBundleShortVersionString was not set properly
  • Icons and LaunchImages were missing, had a bad format (not PNG) or the wrong resolution
@phoet
phoet / bahn.rb
Created September 24, 2013 20:25
scrub the deutsche bahn website for trains leaving hamburg main station to bergedorf
class Bahn
URL = 'http://reiseauskunft.bahn.de/bin/bhftafel.exe'
def initialize
@now = Time.now
@date = @now.strftime('%d.%m.%y')
@time = @now.strftime('%H:%M')
end
def scrape
@phoet
phoet / acceptance_spec_helper.rb
Last active December 23, 2015 19:29
don't put all your stuff in /spec
require 'simplecov'
SimpleCov.command_name "acceptance"
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/poltergeist'