Skip to content

Instantly share code, notes, and snippets.

@nofxx
nofxx / spec_helper.rb
Created October 15, 2011 08:01
Finally working spec_helper spork/mongoid/fabrication/capybara
require 'pry'
require 'spork'
# Loading more in this block will cause your tests to run faster.
# if you change any configuration or code from libraries loaded
# need to restart spork for it take effect.
Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
require 'rails/application'
@nofxx
nofxx / color-theme-fxx.el
Created March 5, 2011 18:55
Emacs color theme
;; Fxx Colour Theme for Emacs.
;;
;; Defines a colour scheme resembling that of the original TextMate Fxx colour theme.
;; To use add the following to your .emacs file (requires the color-theme package):
;;
;; http://wiki.nofxx.com/_detail/x:xxx2tmscreen.png
;;
;; (require 'color-theme)
;; (color-theme-initialize)
;; (load-file "~/.emacs.d/fxx-emacs/color-theme-fxx.el")
@nofxx
nofxx / Makefile
Created February 9, 2011 17:49
AVR Makefile
DEVICE = atmega32 #90s2313
AVRDUDE = avrdude -c usbasp -p $(DEVICE)
# Choose your favorite programmer and interface above.
COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=$(DEVICE) #-DDEBUG_LEVEL=2
# NEVER compile the final product with debugging! Any debug output will
# distort timing so that the specs can't be met.
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
psql -U postgres
create database template_postgis with template = template1;
UPDATE pg_database SET datistemplate = TRUE where datname = 'template_postgis';
\c template_postgis
CREATE LANGUAGE plpgsql;
# arch
\i /usr/share/postgresql/contrib/postgis-1.5/postgis.sql
\i /usr/share/postgresql/contrib/postgis-1.5/spatial_ref_sys.sql;
@nofxx
nofxx / serialize.rb
Created June 28, 2010 23:07
JSON vs BSON
#!/usr/bin/env ruby
require 'benchmark'
require 'json'
require 'bson'
T = 100_000
[{ :foo => 2 }, { :foo => 2, :bar => 3, :baz => "long very very long and big and uncut string" },
{ :foo => 2, :bar => 3, :baz => "long very very long and big and uncut string",
class DeliciousToken < ConsumerToken
DELICIOUS_SETTINGS = {
:site => 'https://api.login.yahoo.com',
:http_method => :get,
:scheme => :query_string,
:request_token_path => '/oauth/v2/get_request_token',
:access_token_path => '/oauth/v2/get_token',
:authorize_path => '/oauth/v2/request_auth',
}
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
#
# Nanite Initializer
#
def load_mapper_opts
YAML.load(File.read(RAILS_ROOT + "/config/rabbitmq.yml"))#.result) #[ENV["RAILS_ENV"] || "development"]
end
if ENV["NO_NM"].nil? && RAILS_ENV != "test"
if defined?(PhusionPassenger)
--- PKGBUILD 2009-07-02 13:17:27.000000000 -0300
+++ PKGBUILD 2009-12-21 16:31:34.000000000 -0200
@@ -1,6 +1,6 @@
# Contributor: p2k <[email protected]>
pkgname=rabbitmq
-pkgver=1.6.0
+pkgver=1.7.0
pkgrel=1
pkgdesc="Highly reliable and performant enterprise messaging implementation of AMQP written in Erlang/OTP"
arch=(i686 x86_64)
require 'tokyotyrant'
module Rack
module Session
class Tyrant < Abstract::ID
include TokyoTyrant
attr_reader :mutex, :pool
DEFAULT_OPTIONS = Abstract::ID::DEFAULT_OPTIONS.merge :tyrant_server => "localhost:1978"
def initialize(app, options = {})
super