Skip to content

Instantly share code, notes, and snippets.

View pmeinhardt's full-sized avatar
🚲

Paul Meinhardt pmeinhardt

🚲
View GitHub Profile
@pmeinhardt
pmeinhardt / hack.sh
Created March 31, 2012 10:08 — forked from DAddYE/hack.sh
osx for hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@pmeinhardt
pmeinhardt / webinspect-ios-simulator.sh
Created April 27, 2012 10:16
web-inspect mobile safari running in the ios simulator
#!/bin/bash
# Based on Nathan de Vries' findings http://goo.gl/jbtzX
MSPID=$(ps x | grep "MobileSafari" | grep -v grep | awk '{ print $1 }')
if [ -z "$MSPID" ]; then
echo "Run \"Mobile Safari.app\" in the Simulater to enable remove debugging."
exit 1
fi
@pmeinhardt
pmeinhardt / completion.rb.patch
Created July 18, 2012 09:53
patch irb completion
--- completion.rb 2012-07-18 11:48:41.000000000 +0200
+++ completion-2.rb 2012-07-18 11:53:02.000000000 +0200
@@ -165,6 +165,7 @@
rescue Exception
name = ""
end
+ next unless name.class == String
next if name != "IRB::Context" and
/^(IRB|SLex|RubyLex|RubyToken)/ =~ name
candidates.concat m.instance_methods(false).collect{|x| x.to_s}
@pmeinhardt
pmeinhardt / webdrive.rb
Created September 18, 2012 06:39
interactive capybara session
#!/usr/bin/env ruby
require 'irb'
require 'irb/completion'
require 'selenium/webdriver'
require 'capybara/dsl'
if ARGV.delete "--chrome"
chrome = true
@pmeinhardt
pmeinhardt / capybara.rb
Created October 18, 2012 10:04
capybara iphone driver
# features/support/capybara.rb
# Configure Capybara for use with cucumber.
Capybara.configure do |config|
# Use iPhone as the default browser.
# config.default_driver = :iphone
end
@pmeinhardt
pmeinhardt / gist:3949491
Created October 24, 2012 23:03
OAuth 2 for Native Apps
@pmeinhardt
pmeinhardt / guide.md
Created November 17, 2012 18:28
clean rails server setup

Server setup

Basic setup

The baseline setup:

  1. Nginx will be used to reverse proxy to the Rails app (run by unicorn/thin/...)
  2. A non-privileged user is created, which will be running the app and used for safe deployments
  3. For this user, we'll install:
  4. rbenv (https://github.com/sstephenson/rbenv) to manage multiple Ruby versions
@pmeinhardt
pmeinhardt / unicorn.rb
Last active December 10, 2015 00:59
capistrano unicorn integration
# Unicorn itself is configured in `config/unicorn.rb`. These are the tasks,
# that allow you to control the server through Capistrano's `cap` command.
# To understand how Unicorn reacts to each signal, you should really read
# http://unicorn.bogomips.org/SIGNALS.html
namespace :unicorn do
task :start do
env = fetch(:rails_env, "production")
run <<-EOC
@pmeinhardt
pmeinhardt / data-uri.rb
Last active December 10, 2015 01:58
encode files with the data-uri scheme using base64
#!/usr/bin/env ruby
require 'base64'
require 'rack/mime'
if ARGV.empty?
puts "usage: #{File.basename($0)} [glob ...]"
exit 0
end