This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: Be sure to set the API key further down in the code! | |
require "net/http" | |
require "uri" | |
require "json" | |
class WIP | |
def initialize(api_key:) | |
@api_key = api_key | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def auto_clear | |
begin | |
result = yield self | |
result.equal?(self) ? nil : result # avoid leaking | |
ensure | |
clear | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#file: app/controllers/tsheets/users_controller.rb | |
module Tsheets | |
class UsersController < ApplicationController | |
def update | |
# does something important here | |
render json: 'test: test' | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GEM | |
remote: https://rubygems.org/ | |
specs: | |
enumerable-lazy (0.0.2) | |
ffi (1.9.18) | |
haml (5.0.3) | |
temple (>= 0.8.0) | |
tilt | |
i18n (0.8.6) | |
mail (2.6.6) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
ruby '2.4' | |
gem 'faker' | |
gem 'watir' | |
gem 'selenium-webdriver' | |
gem 'pry' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
ruby '2.4' | |
gem 'benchmark-ips' | |
gem 'yajl-ruby' | |
gem 'oj' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
ruby '2.4' | |
gem 'benchmark-ips' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ostruct' | |
require 'benchmark' | |
require 'values' | |
COUNT = 10_000_000 | |
NAME = "Test Name" | |
EMAIL = "[email protected]" | |
class Person | |
attr_accessor :name, :email |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QuestionType | |
## This is a class to avoid database lookup for survey_question_types table | |
## replicate actual table : | |
# id => :name | |
DATA = { | |
3 => 'Rank order', | |
4 => 'Constant sum', | |
5 => 'Drop-down menu', | |
6 => 'Numeric Freeform Input', | |
7 => 'Comment Box', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# read here: http://blog.iempire.ru/2015/10/13/profiling-specs/ | |
RSpec.configure do |config| | |
config.around(:each) do |example| | |
path = Rails.root.join("tmp/stackprof-cpu-test-#{example.full_description.parameterize}.dump") | |
StackProf.run(mode: :cpu, out: path.to_s) do | |
example.run | |
end | |
end | |
end |