Skip to content

Instantly share code, notes, and snippets.

# SQLite version 3.x
# gem install sqlite3
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
@hartator
hartator / gist:6404820
Created September 1, 2013 14:34
Rails 4.0.0 Error: no-implicit-conversion-of-nil-into-string
➜ rififi rails s
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2013-09-01 16:31:08] INFO WEBrick 1.3.1
[2013-09-01 16:31:08] INFO ruby 2.0.0 (2013-05-14) [x86_64-darwin12.2.0]
[2013-09-01 16:31:08] INFO WEBrick::HTTPServer#start: pid=3204 port=3000
@hartator
hartator / gist:6405096
Created September 1, 2013 15:21
Error "no implicit conversion of nil into String” in vanilla rails app
Last login: Sun Sep 1 10:44:53 on ttys002
You have new mail.
➜ ~ cd apps/
➜ apps rails new oubado
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
@hartator
hartator / gist:6405136
Created September 1, 2013 15:27
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.0.0)
actionpack (= 4.0.0)
mail (~> 2.5.3)
actionpack (4.0.0)
activesupport (= 4.0.0)
builder (~> 3.1.0)
erubis (~> 2.7.0)
@hartator
hartator / gist:6405145
Last active December 22, 2015 02:39
database.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
@hartator
hartator / gist:6689203
Created September 24, 2013 18:32
Hack to make select2 v3.2 save the user input on blur for tags input.
/*
Copyright 2012 Igor Vaynberg
Version: 3.2 Timestamp: Mon Sep 10 10:38:04 PDT 2012
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in
compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
development:
# Configure available database sessions. (required)
sessions:
# Defines the default session. (required)
default:
# Defines the name of the default database that Mongoid can connect to.
# (required).
database: milliards_development
# Provides the hosts the default session can connect to. Must be an array
# of host:port pairs. (required)
class Blur
include Mongoid::Document
field :name, type: String
end
module DeepFetch
def deep_fetch(*keys, &fetch_default)
throw_fetch_default = fetch_default && lambda {|key, coll|
args = [key, coll]
# only provide extra block args if requested
args = args.slice(0, fetch_default.arity) if fetch_default.arity >= 0
# If we need the default, we need to stop processing the loop immediately
throw :df_value, fetch_default.call(*args)
}
catch(:df_value){