Skip to content

Instantly share code, notes, and snippets.

# 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:
#
# 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')
#
# 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
@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
# 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: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"
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 / 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"
@nofxx
nofxx / nginx
Created August 23, 2009 00:05
nginx rc.d script archlinux
#!/bin/bash
# NGINX RC.D SCRIPT
# Archlinux
NGINX_CONFIG="/opt/nginx/conf/nginx.conf"
NGINX_BIN="/opt/nginx/sbin/"
#. /etc/conf.d/nginx
. /etc/rc.conf
. /etc/rc.d/functions
#!/usr/bin/env ruby
#
# Simple script to rename all columns/index/seq on rails app postgresql db
#
# Usage: pg_rename foo bar
#
require 'rubygems'
require 'activerecord'
require 'annotate/annotate_models'
require 'config/boot'