Skip to content

Instantly share code, notes, and snippets.

Taylor Boyko tboyko

Block or report user

Report or block tboyko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tboyko
tboyko / redis-mem.rb
Last active Mar 25, 2018
Shows how rss memory changes during usage of redis gem
View redis-mem.rb
require 'redis'
def Process.rss ; `ps -o rss= -p #{Process.pid}`.chomp.to_i ; end
def Process.pretty_rss
GC.start(full_mark: true, immediate_sweep: true)
Process.rss.to_s.gsub(/(\d)(?=(\d{3})+(\..*)?$)/,'\1,') + " kilobytes"
end
puts "start: #{Process.pretty_rss}"
@tboyko
tboyko / convert.rake
Last active Dec 29, 2015 — forked from buffym/convert.rake
added ability for script to automatically determine database name.
View convert.rake
desc "convert a latin1 database with utf8 data into proper utf8"
task :convert_to_utf8 => :environment do
puts Time.now
dryrun = ENV['DOIT'] != '1'
conn = ActiveRecord::Base.connection
if dryrun
def conn.run_sql(sql)
puts(sql)
end
else
View gist:2173624
validates :enrollment_method,
presence: true,
inclusion: {
in: ['email', 'phone_number']
}
validates :email,
presence: true,
format: {
with: /\A[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]+\z/,
You can’t perform that action at this time.