Skip to content

Instantly share code, notes, and snippets.

@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)
@Yorkshireman
Yorkshireman / _hello_world.slim
Last active May 6, 2021 15:39
slim partials in Sinatra
h1 Hello, World! Hello #{name}!
/ I initially had only `.render({}, locals)`, which meant that the partials didn't
/ have access to any helper methods contained inside `OtherHelperMethods` (but `home.slim` did).
/ Passing `self` into `.render`, as the first argument, fixes that (if you're curious
/ about that, look up the `Tilt::Template #render` documentation.
/ With this PartialsHelper, passing locals is optional, as is specifying a different
/ path to the partial (relative to `settings.views`).