Skip to content

Instantly share code, notes, and snippets.

@pietia
pietia / application_controller.rb
Created May 24, 2012 09:19 — forked from crosebrugh/application_controller.rb
Rails Admin config and runtime management
# add this to your ../app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
before_filter { |c| _admin_prolog(c) } # should be the first one!
after_filter { |c| _admin_epilog(c) } # should be the last one!
@pietia
pietia / config.ru
Created March 1, 2012 22:44
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
require "rails"
[WARNING] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
[WARNING] log4j:WARN Please initialize the log4j system properly.
[INFO] DataMapperOrm::Tests::LoadPeople=====================================
[INFO] DataMapperOrm::Tests::LoadPeople;1;0;0.230000;0.230000;0.229000;0.230000;0.230000;0.229000;1;1;10
[INFO] DataMapperOrm::Tests::LoadPeople;1;1;0.240000;0.240000;0.240000;0.240000;0.240000;0.240000;1;1;10
[INFO] DataMapperOrm::Tests::LoadPeople;0;0;0.084000;0.084000;0.084000;0.084000;0.084000;0.084000;1;1;10
[INFO] DataMapperOrm::Tests::LoadPeople;0;1;0.087000;0.087000;0.087000;0.087000;0.087000;0.087000;1;1;10
[INFO] DataMapperOrm::Tests::LoadPeople;1;0;0.819000;0.819000;0.819000;0.081900;0.081900;0.081900;10;1;10
[INFO] DataMapperOrm::Tests::LoadPeople;1;1;0.371000;0.371000;0.370000;0.037100;0.037100;0.037000;10;1;10
[INFO] DataMapperOrm::Tests::LoadPeople;0;0;0.388000;0.388000;0.389000;0.038800;0.038800;0.038900;10;1;10
#!/bin/bash
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi
echo ""
echo "================================================================"
echo "\tBASIC RAILS DEVELOPMENT SETUP"
@pietia
pietia / gist:233754
Created November 13, 2009 11:11 — forked from myabc/gist:233747
diff --git a/data_objects/lib/data_objects/spec/typecast/string_spec.rb b/data_objects/lib/data_objects/spec/typecast/string_spec.rb
index 4b15afb..f06ef2c 100644
--- a/data_objects/lib/data_objects/spec/typecast/string_spec.rb
+++ b/data_objects/lib/data_objects/spec/typecast/string_spec.rb
@@ -83,4 +83,25 @@ share_examples_for 'supporting String' do
end
+ class StringWithExtraPowers < String; end
+
require 'benchmark'
require 'rubygems'
require 'addressable/uri'
require 'pathname'
include Benchmark
dir = File.dirname(__FILE__)
lib_path = File.expand_path("#{dir}/lib")
$LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
# put data_objects from repository in the load path
Code
----
* next branch
* master branch
OS:
---
* Windows
rake spec results:
MySQL
102 examples, 1 failure, 1 pending
Postgres
114 examples, 10 failures, 1 pending
SQLite3
SQlite3 -- database locked
@pietia
pietia / .gitignore
Created January 14, 2009 09:42 — forked from radarek/.gitignore
*.rbc
*.pyc