Skip to content

Instantly share code, notes, and snippets.

@woodie
woodie / logging.properties
Created January 5, 2010 04:21
Set log level on App Engine for JRuby
# Specify the handlers to create in the root logger
# (all loggers are children of the root logger)
# The following creates two handlers
handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
# Set the default logging level for the root logger
.level = ALL
# Set the default logging level for new ConsoleHandler instances
java.util.logging.ConsoleHandler.level = INFO
@nragaz
nragaz / all.god
Created July 12, 2010 03:16
God configs for starting Resque and Unicorn
PID_DIR = '/srv/myapp/shared/pids'
RAILS_ENV = ENV['RAILS_ENV'] = 'production'
RAILS_ROOT = ENV['RAILS_ROOT'] = '/srv/myapp/current'
BIN_PATH = "/home/rails/.rvm/gems/ree-1.8.7-2010.02/bin"
God.log_file = "#{RAILS_ROOT}/log/god.log"
God.log_level = :info
%w(unicorn resque).each do |config|
God.load "#{RAILS_ROOT}/config/god/#{config}.god"
@ralfebert
ralfebert / .bashrc
Created August 9, 2010 19:16
git settings
# Prompt (Debian)
source /usr/local/bin/git-completion.sh
# Prompt (OS X + homebrew)
source /usr/local/etc/bash_completion.d/git-completion.bash
PS1="\[\033[31;38m\]\w\[\033[1;31m\]\$(__git_ps1)\[\033[00m\] "
export GIT_PS1_SHOWDIRTYSTATE=1

(a gist based on the old toolmantim article on setting up remote repos)

To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.

This is somewhat of a follow-up to the previous article setting up a new rails app with git.

For the impatient

Set up the new bare repo on the server:

package br.com.caelum.teste;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import org.hibernate.validator.constraints.ScriptAssert;
@telent
telent / gist:704274
Created November 17, 2010 22:46
Some random notes on Mirah, mostly culled from the mailing list

Stuff in Ruby that is/isn't supported, or is different

=begin / =end

Rib Rdb writes: "The new parser doesn't support this". Use single line comments instead

The object model

The ruby object model is not the same as the java object model. The

@raul
raul / set_request_headers.rb
Created November 27, 2010 11:33
Set request headers in Capybara+RackTest
# Patch to support customized request headers in your Capybara tests
# when you're using the RackTest driver, based on an Aslak Hellesøy's gist:
# https://gist.github.com/358664
#
# Please note that some drivers don't allow access to headers, see:
# https://github.com/jnicklas/capybara/issuesearch?state=closed&q=header#issue/17
class Capybara::Driver::RackTest < Capybara::Driver::Base
def env
@toluju
toluju / delicious2google.rb
Created December 17, 2010 01:02
Delicious is shutting down, so here's a script to load the exported delicious bookmarks into Google Bookmarks.
require 'net/http'
require 'uri'
require 'cgi'
text = "<html><head><title>Delicious2Google</title></head><body>" +
"<h1>Upload</h1>" +
"<form action='https://www.google.com/bookmarks/mark?op=upload&zx=#{rand(65535)}' method='POST'>" +
"<input type='submit'/><input type='hidden' id='data'></form>" +
"<textarea id='xml' style='display:none'>\n<bookmarks>"
class Fixnum
def seconds
self
end
def minutes
self * 60
end
def hours
# When anything, including nil, is a valid param and you need
# a clear way to know if a param was set or not, use `None`.
None = Object.new
def foo(a, b=None)
result = [a]
if b != None
result << b
end