Skip to content

Instantly share code, notes, and snippets.

source 'https://rubygems.org'
gem 'rails', '~> 4.2.7.1'
gem 'devise', '~> 3.5.0'
gem 'rspec-rails', '~> 3.4.0'
@fcheung
fcheung / notes.md
Created November 27, 2017 16:28
changes observed from ruby mongo 1.x to 2.x

#Updating from mongo ruby drive 1.x to 2.x

We've recently been belatedly migrating to the 2.x series of the mongo ruby driver. At least in part this is because there's very little documentation out there on what has changed, except that there is no backwards compatibility. This post is a list of issues that we came across - I expect it is by no means exhaustive

Dependencies

Before you get started, make sure that any dependencies you have are also comaptible with mongo 2.x. For example database_cleaner needs to be 1.5 or higher

@fcheung
fcheung / get_mem.rb
Created July 5, 2019 22:13
get_process_mem
require 'ffi'
require 'get_process_mem'
require 'benchmark/ips'
module MemoryInfo
extend FFI::Library
ffi_lib 'c'
attach_function :mach_task_self, [], :__darwin_mach_port_t
attach_function :task_info,
[
@fcheung
fcheung / results
Created July 27, 2019 14:03
unpack cookie benchmark
require 'benchmark/ips'
def reverse(session_data)
digest, session_data = session_data.reverse.split('--', 2)
digest.reverse! if digest
session_data.reverse! if session_data
[session_data, digest]
end
def index(session_data)
require 'benchmark/ips'
Benchmark.ips do |x|
x.config(time: 60, warmup: 5)
x.config(stats: :bootstrap, confidence: 95)
x.report('binstub') { `bin/rspec -v`}
x.report('bundle exec') {`bundle exec rspec -v `}
x.report('direct') {`rspec -v `}
end