Skip to content

Instantly share code, notes, and snippets.

View abner's full-sized avatar

Ábner Silva de Oliveira abner

View GitHub Profile
@tritonrc
tritonrc / ldap_admin.rb
Created January 17, 2011 19:55
Simple Sinatra based LDAP admin tool
require 'rubygems'
require 'sinatra'
require 'net-ldap'
require 'digest/sha1'
require 'base64'
require 'haml'
LDAP_HOST = 'localhost'
ADMIN_DN = 'cn=admin,dc=company,dc=com'
@nicksieger
nicksieger / concurrent.rb
Created May 19, 2011 21:31
JRuby code examples from RailsConf 2011
require 'java'
java_import java.util.concurrent.Executors
@count = java.util.concurrent.atomic.AtomicInteger.new
def send_email(executor)
executor.submit do
puts "email #{@count.incrementAndGet} sent"
end
end
require "uri"
(URI::REGEXP.constants - ["PATTERN"]).each do |rc|
puts "#{rc}: #{URI::REGEXP.const_get(rc)}"
end
URI::REGEXP::PATTERN.constants.each do |pc|
puts "#{pc}: #{URI::REGEXP::PATTERN.const_get(pc)}"
end
@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.

@holman
holman / gemspec-usage.md
Created February 12, 2012 07:02
test/spec/mini

Just install this in your apps like so:

gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'

@rafaelp
rafaelp / attr_acessible_security.rb
Created March 5, 2012 03:59
How to protect against mass assignment attack
# Put this file on config/initializer
# This will create an empty whitelist of attributes available for mass assignment for
# all models in your app. As such, your models will need to explicitly whitelist
# accessible parameters by using an attr_accessible declaration. This technique is best
# applied at the start of a new project. However, for an existing project with a thorough
# set of functional tests, it should be straightforward and relatively quick to insert this
# initializer, run your tests, and expose each attribute (via attr_accessible) as dictated
# by your failing tests.
@abner
abner / concurrent.rb
Created April 20, 2012 20:50 — forked from nicksieger/concurrent.rb
JRuby code examples from RailsConf 2011
require 'java'
java_import java.util.concurrent.Executors
@count = java.util.concurrent.atomic.AtomicInteger.new
def send_email(executor)
executor.submit do
puts "email #{@count.incrementAndGet} sent"
end
end
tell application "iTerm"
activate
tell (make new terminal)
tell (launch session "initial_session") to write text "cd ~/workspace/project1; clear"
tell i term application "System Events" to keystroke "D" using command down
tell last item of sessions to write text "cd ~/workspace/work/project2; clear"
tell i term application "System Events" to keystroke "d" using command down
tell last item of sessions to write text "cd ~/workspace/work/project3; clear"
@jordansissel
jordansissel / readme.md
Created August 5, 2012 17:46
ruby processing speeds with the lumberjack (prototype) protocol
@agnoster
agnoster / README.md
Last active July 29, 2024 09:17
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark