View PinchZoomPan.js
import React from 'react';
const MIN_SCALE = 1;
const MAX_SCALE = 4;
const SETTLE_RANGE = 0.001;
const ADDITIONAL_LIMIT = 0.2;
const DOUBLE_TAP_THRESHOLD = 300;
const ANIMATION_SPEED = 0.04;
const RESET_ANIMATION_SPEED = 0.08;
const INITIAL_X = 0;
View endpoints.md
View git-cleanup-repo
#!/bin/bash
# git-cleanup-repo
#
# Author: Rob Miller <rob@bigfish.co.uk>
# Adapted from the original by Yorick Sijsling
#
# * 2015/11/05 - Fixed formatting issues (Stephan Schubert)
KEEP_BRANCHES='(master|staging|ci-[0-9]+)$'
View reinstall-everything-brewd.sh
#!/bin/bash
for i in `brew list -1`
do
if [[ "$i" == python.* ]] || [[ "$i" == ruby.* ]]
then
continue
fi
brew rm --force $i && brew install $i
done
View private_delegate.rb
class Module
def private_delegate(*methods)
delegate(*methods)
methods.extract_options!
methods.each { |m| private(m) }
end
end
View bench_rails_memory_usage.rb
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
View railsexpress-patched-ruby-for-rbenv.sh
#!/bin/bash
# This script creates a custom ruby definition for rbenv
# which incorporates the rvm patches from skaes.
#
# (c) frank.schumacher.privat@gmail.com
#
rubyexpress_repo="https://github.com/skaes/rvm-patchsets.git"
rubybuild_repo="https://github.com/sstephenson/ruby-build.git"
mkdir rbenv-railsexpress
View selecta_search_history.zsh
function exists { which $1 &> /dev/null }
if exists selecta; then
function selecta_select_history() {
local tac
exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } }
BUFFER=$(fc -l -n 1 | eval $tac | selecta $LBUFFER)
CURSOR=$#BUFFER # move cursor
zle -R -c # refresh
}
View compact.gemspec
Gem::Specification.new do |s|
s.name = 'compact'
s.version = '0.0.1'
s.platform = Gem::Platform::RUBY
s.author = 'Stephan Schubert'
s.email = 'stephan@frozencherry.de'
s.summary = 'Hash#compact'
s.description = 'Removes all keys with nil as value.'
s.files = ['compact.rb']
View database_cleaner.rb
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end