Skip to content

Instantly share code, notes, and snippets.

View reicheltd's full-sized avatar

Daniel R. reicheltd

View GitHub Profile
@norman
norman / benchmarks.txt
Last active September 26, 2015 16:58
Friendly Id Benchmarks
Git revision: 9b395bad80da30f0101e5df91cc9d18aeac2b3c1
$ BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.0.rb DB=postgres bundle exec rake bench
------------------------------------------------------------------------
Using ruby 2.0.0 AR 4.0.0 with postgres
Rehearsal ----------------------------------------------------------------------------------
find (without FriendlyId) 0.340000 0.030000 0.370000 ( 0.473857)
find (in-table slug) 0.990000 0.040000 1.030000 ( 1.285145)
find (in-table slug; included FinderMethods) 0.420000 0.020000 0.440000 ( 0.663232)
find (external slug) 1.630000 0.050000 1.680000 ( 2.194663)
@pahanix
pahanix / gist:885671
Created March 24, 2011 19:22
Clear your logs in development automatically when they are too large.
# config/initializers/clear_logs.rb
# This snippet simply clears your logs when they are too large.
# Large logs mean looooong search in TextMate. You know it :)
# Every time you run rails server or rails console it checks log sizes
# and clears the logs for you if necessary.
if Rails.env.development?
MAX_LOG_SIZE = 2.megabytes
@jszmajda
jszmajda / test_http_clients.rb
Created February 10, 2011 22:26
a benchmark to test Net::HTTP, HTTParty, Curb, and system curl
require 'rubygems'
require 'httparty'
require 'curb'
require 'net/http'
require 'benchmark'
include Benchmark
RUNS = 1000
url = 'http://localhost:4567/'
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@dysinger
dysinger / simple-nginx-webdav.sh
Created January 5, 2010 20:32
A simple nginx/webdav setup for use with things like mobile-org
#!/bin/sh
# on ubuntu: need some utils & dev libs
sudo apt-get install apache2-utils openssl libssl-dev libpcre3-dev
# compile nginx
cd /tmp
curl http://nginx.org/download/nginx-0.7.64.tar.gz | tar xz
cd nginx*
./configure --with-http_ssl_module --with-http_dav_module \