Skip to content

Instantly share code, notes, and snippets.

@johnkeith
johnkeith / test_failing_as_expected.rb
Last active April 15, 2020 21:04
Test that is not filtering by the search scope provided
# this test is in the API documents_controller spec file.
test 'index with search scope filter and perspective' do
place = create :place, contacts: [
{ first_name: 'Matt', last_name: 'Johnson' },
{ first_name: 'Peter', last_name: 'McCallister' }
]
search_scope = Place.scope_builder['city'].equals(place.city).create_search_scope
search_scope.update!(perspective: 'contacts')
@johnkeith
johnkeith / pull_request_template.md
Last active April 24, 2018 21:33
Pull Request Template Proposal

Description of Changes:

JIRA Story:

Linked PRs

  • IMS-API: N/A
  • IMS-Admin: N/A
  • IMS-Investor: N/A
  • IMS-Console: N/A
#!/bin/sh
# you will need to copy this script into the .git/hooks dir for each repo IMS-API, IMS-Administrator, IMS-Investor
# make sure you chmod this file when you put it in your .git/hooks dir
# for example, chmod +x .git/hooks/post-checkout
# checking out a file, so doing nothing
if [ "$3" == "0" ]; then exit; fi
BRANCH_NAME=$(git symbolic-ref --short -q HEAD)
require 'benchmark'
$num_of_iterations = 1000000
def test_equals_sign
$num_of_iterations.times do
1 == 2
end
end
{"E":{"Fairview":{"headers":[{"label":"Fairview"}],"body":{"projected_loss_and_severity":{"projected_loss":{"label":"Projected Loss($)","value":"-2083377.65","type":"currency","editable":true},"projected_loss_severity":{"label":"Loss Severity(%)","value":"15.085813869001472","type":"percent","editable":false}},"reconciled_value":{"reconciled_value":{"label":"Reconciled Value","value":"16900000.0","type":"currency","editable":true},"value_per_unit":{"label":"Value/Unit","value":"172.46657822226757832431880804163690172466578222267578324318808041636901724665782222675783243188080416369017246657822226757832431880804163690172466578222267578324318808041636901724665782222675783243188","type":"currency","editable":false},"implied_cap_rate":{"label":"Implied Cap Rate","value":"7.1976723106508875739644970414201183431952662721893491124260355029585798816568047337278106508875739644970414201183431952662721893491124260355029585798816568047337278106508875739644970414201183431952663","type":"percent","editable":false},"ltv":{"
class Bike
end
class RoadBike < Bike
end
class MountainBike < Bike
end
class Wheel
require 'book_store'
require 'employee'
require 'book'
books = [
{ title: 'The Great Gatsby', author: 'F. Scott Fitzgerald', pub_date: 1925 },
{ title: 'Their Eyes Were Watching God', author: 'Zora Neale Hurston', pub_date: 1937 }
]
books_for_store = []
context "get loan_strats for all securitizations", test_all_securitizations: true do
let(:relevant_securitizations) do
DimSecuritization.all.pluck(:dwidSecuritization) - ElasticsearchExclude.all.pluck(:id)
end
it 'visits the page and renders the template for all securitizations' do
log_and_print "Testing all #{relevant_securitizations.length} key securitizations"
relevant_securitizations.each do |dwid|
log_and_print "Testing Loan Strats controller action for securitization #{dwid}"
the_request = get 'loan_strats', format: :html, dwidSecuritization: dwid
@johnkeith
johnkeith / gist:8f202967cd91698643c5
Created June 25, 2014 19:45
secret_secret_hash_challenge
require 'digest/md5'
erics_hash = "b354e9b8c7a5fb1e073670a28f957032"
("a".."z").each do |first|
("a".."z").each do |second|
("a".."z").each do |third|
("a".."z").each do |fourth|
("a".."z").each do |fifth|
("a".."z").each do |sixth|
test = first + second + third + fourth + fifth + sixth
require_relative 'board'
require_relative 'timer_classes'
require_relative 'color_dots'
require 'pry'
require 'gosu'
require 'rubygems'
#-----------------------------------CONSTANTS-----------------------------#
SCREEN_WIDTH = 721