Skip to content

Instantly share code, notes, and snippets.

View stereoscott's full-sized avatar

Scott Meves stereoscott

View GitHub Profile
@stereoscott
stereoscott / random_text.sql
Created June 22, 2014 17:38
PostgreSQL random text function
-- http://www.postgresql.org/message-id/bddc86150908200534p14723ac2vd1ef223af095d822@mail.gmail.com
CREATE OR REPLACE FUNCTION
random_text(INTEGER)
RETURNS TEXT
LANGUAGE SQL
AS $$
SELECT array_to_string(array(
SELECT SUBSTRING('23456789abcdefghjkmnpqrstuvwxyz'
FROM floor(random()*31)::int+1 FOR 1)
Process: GitX [88336]
Path: /Applications/GitX.app/Contents/MacOS/GitX
Identifier: net.phere.GitX
Version: 0.15.1962 dev (0.15.1962)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: GitX [88336]
User ID: 501
Date/Time: 2014-11-03 03:31:53.855 -0500
gem 'activerecord', '4.1.5'
require 'active_record'
require 'minitest/autorun'
require 'logger'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do