Skip to content

Instantly share code, notes, and snippets.

View jdblack's full-sized avatar

James Blackwell jdblack

View GitHub Profile
@schickling
schickling / Rakefile
Last active January 31, 2024 23:00
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@scttnlsn
scttnlsn / app.rb
Created October 18, 2011 13:59
Sinatra/Mongoid RESTful resource
require 'mongoid'
require 'sinatra'
require_relative 'resource'
class Example
include Mongoid::Document
field :name
field :created, :type => DateTime