Skip to content

Instantly share code, notes, and snippets.

View nofxx's full-sized avatar
🍺
Drinking

Marcos Piccinini nofxx

🍺
Drinking
View GitHub Profile
@nofxx
nofxx / tyrant.rake
Created July 15, 2009 03:10
Tokyo Tyrant rake tasks
#
# Tokyo Tyrant rake tasks
#
# rake tyrant:restart # Restart Tyrant server
# rake tyrant:start # Start Tyrant server
# rake tyrant:stop # Stop Tyrant server
#
namespace :tyrant do
desc "Start Tyrant server"
class LogApp
def initialize(m, c, text, req)
HoptoadNotifier.notify(
:error_class => m.to_s.capitalize,
:error_message => text,
:request => req,
:backtrace => c)
end
@nofxx
nofxx / gist:132160
Created June 18, 2009 20:02
Tokyo Cabinet / Memcached
require 'memcache'
require 'memcached'
require 'rufus/tokyo'
require 'tokyocabinet'
tc = TokyoCabinet::HDB.new('tc.tch')
tffi = Rufus::Tokyo::Cabinet.new('tffi.tch')
mc = Memcached.new "localhost:11211"
mr = MemCache.new "localhost:11211"
# Ramaze Cucumber
require 'ramaze'
require 'webrat'
require 'ramaze/spec/bacon'
require File.join(File.dirname(__FILE__), *%w[.. .. start.rb])
def app; Ramaze.middleware; end
Ramaze.setup_dependencies
Webrat.configure do |config|
@nofxx
nofxx / gist:83369
Created March 23, 2009 01:18
xorg.conf
Section "ServerLayout"
# PS/2 Mouse not detected
# Serial Mouse not detected
Identifier "Xorg Configured"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "USB Mouse" "CorePointer"
# Option "AIGLX" "on"
EndSection
#
# Return UTM Zone for a geom
#
# Return Integer
def utm_zone
geomgeog = srid == 4326 ? self[get_column_name] : transform(4326)
puts geomgeog.class
geom = case geomgeog.class.to_s
when /Point/ then geomgeog
when /LineString/ then geomgeog.first
# Ruby Git Archlinux PKGBUILD
# Contributor: nofxx <[email protected]>
pkgname=ruby-git
pkgver=20081228
pkgrel=1
pkgdesc="A dynamic, open source programming language with a focus on simplicity and productivity."
arch=(i686 x86_64)
url="http://www.ruby-lang.org/en/"
license="Ruby"
depends=('glibc' 'gdbm' 'db' 'openssl' 'zlib' 'readline')
# Copyright (c) 2008 Nicholas A. Evans
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
@nofxx
nofxx / deploy.rb
Created November 1, 2008 19:37
Cap Recipe
# #
# CAPISTRANO 2.5.0 DEPLOY
# GIT, Passenger, BackgrounDRB, Juggernaut
#
# Workflow:
# cap <stage> <task>
# cap <stage> deploy:setup
# cap <stage> deploy:cold
# . . .
# cap <stage> deploy
@nofxx
nofxx / .autotest
Created October 5, 2008 09:55
RSpec 1.1.8 autospec only works with this...
Autotest.add_hook :initialize do |at|
at.clear_mappings
at.add_mapping(%r{^spec/.+_spec\.rb$}) do |filename,_|
filename
end
at.add_mapping(%r{^lib/< project folder!! >/(.+)\.rb$}) do |_,match|
[ "spec/< project folder!!!! >/#{match[1]}_spec.rb" ] +
at.files_matching(%r{^spec/integration/.+_spec\.rb$})