Skip to content

Instantly share code, notes, and snippets.

View christos's full-sized avatar

Christos Zisopoulos christos

View GitHub Profile
@joshsusser
joshsusser / gist:998055
Created May 29, 2011 19:20
turn off 255 limit for string fields in postgresql
# in rails application.rb
initializer "postgresql.no_default_string_limit" do
ActiveSupport.on_load(:active_record) do
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:string].delete(:limit)
end
end
@wtaysom
wtaysom / where_is.rb
Created September 23, 2011 08:57
A little Ruby module for finding the source location where class and methods are defined.
module Where
class <<self
attr_accessor :editor
def is_proc(proc)
source_location(proc)
end
def is_method(klass, method_name)
source_location(klass.method(method_name))
@vhyza
vhyza / catch_exception.rb
Created November 10, 2011 10:53
Removed require 'cgi' to avoid segmentation fault
# encoding: utf-8
STDOUT.sync = true
STDERR.sync = true
require 'pathname'
at_exit do
if (e = $!) && !e.instance_of?(SystemExit)
require "#{ENV['TM_SUPPORT_PATH']}/lib/escape"
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
@ruckus
ruckus / gist:2293434
Created April 3, 2012 16:36
Basic setup of WAL-E for continuous archiving and recovery

WAL-E needs to be installed on all machines, masters and slaves.

How to install WAL-E

Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf is:

archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60
@panthomakos
panthomakos / benchmark.rb
Created May 3, 2012 20:06
Benchmark Your Bundle
#!/usr/bin/env ruby
require 'benchmark'
REGEXPS = [
/^no such file to load -- (.+)$/i,
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
/^Missing API definition file in (.+)$/i,
/^cannot load such file -- (.+)$/i,
]
@anaisbetts
anaisbetts / gist:2606426
Created May 6, 2012 00:02 — forked from rtomayko/gist:2601550
Open beautiful git-scm.com manual pages w/ git help
# The new git-scm.com site includes man pages designed for pleasant viewing in a web browser:
#
# http://git-scm.com/docs
#
# The commands below can be used to configure git to open these pages when
# using `git help <command>' from the command line. Just enter the config
# commands in your shell to modify your ~/.gitconfig file.
# Create a new browser command and configure help -w to use it.
git config --global browser.gitscm.cmd "/bin/sh -c 'open http://git-scm.com/docs/\$(basename \$1 .html)' --"
@dakatsuka
dakatsuka / amqp.rb
Created May 14, 2012 09:02
Rails3 + unicorn + RabbitMQ
# config/initializers/amqp.rb
require 'amqp/utilities/event_loop_helper'
require 'amqp/integration/rails'
module AMQPManager
def self.start
AMQP::Utilities::EventLoopHelper.run
AMQP::Integration::Rails.start do |connection|
connection.on_error do |ch, connection_close|
raise connection_close.reply_text
@mamuso
mamuso / songs.scpt
Created June 20, 2012 21:33
Play a sound during multiple slides in keynote with AppleScript
set dontplay to 0
tell application "Keynote"
start from slide 1 of front slideshow
end tell
set volume output volume 80
repeat
tell application "Keynote"
tell front slideshow