This file contains 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
defmodule Test do | |
@moduledoc """ | |
Documentation for `Test`. | |
""" | |
@spec find_stack_pair(any) :: Integer | |
def find_stack_pair(list) do | |
list | |
|> pairwise() | |
|> IO.inspect(label: "after pairing") | |
|> calculate() |
This file contains 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 'will_paginate' |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am adamrobbie on github. | |
* I am adamrobbie (https://keybase.io/adamrobbie) on keybase. | |
* I have a public key ASDXwfa1LGkjFtp9MtsGYrFK9mn9YqJoHiN12Al8gJd8UAo | |
To claim this, I am signing this object: |
This file contains 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
defmodule Havershine do | |
def distance(lng1, lat1, lng2, lat2) do | |
[rLng1, rLat1, rLng2, rLat2] = for deg <- [lng1, lat1, lng2, lat2], do: deg2rad(deg) | |
dLon = rLng2 - rLng1 | |
dLat = rLat2 - rLat1 | |
a = :math.pow(:math.sin(dLat/2), 2) + :math.cos(rLat1) * :math.cos(rLat2) * :math.pow(:math.sin(dLon/2), 2) | |
c = 2 * :math.asin(:math.sqrt(a)) |
This file contains 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
My current understanding of the process.. | |
- 1 upload excell | |
- 2 hrflow creates form collector and a set or participant flows | |
- 3 form collector sends emails to participants with a link to the appropriate HRFORM | |
- upon completion of the partiicpant form, HRForms uses the completionURL to let us know | |
- if they have a spouse (unsure from the weird payload how this is deteremined, marriage status etc), we should send an email | |
to the spouse with another HRForm url | |
- upon that completion we'll recieve another post to our submitform endpoint and fetch the data again and send the event along to the | |
participant form. | |
- eventually we want the participant fsm to complete with a signed boolean, unsure when this is determined as from the code this is assumed to happen |
This file contains 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
ENV["RAILS_ENV"] = "test" | |
require File.expand_path('../../config/environment', __FILE__) | |
require File.dirname(__FILE__) + '/blueprints' | |
require 'faker' | |
require 'rails/test_help' | |
require 'minitest/autorun' | |
require 'minitest/pride' | |
class MiniTest::Unit::TestCase | |
include MiniTest::ActiveRecordAssertions |
This file contains 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
module MiniTest | |
module Assertions | |
module ActiveRecord | |
# assert_association User, :has_many, :editables, :polymorphic => true | |
# | |
def assert_association(clazz, association, associate, options={}) | |
reflected_assoc = clazz.reflect_on_association(associate) |
This file contains 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 to_bool | |
return true if self == true || self =~ (/(true|t|yes|y|1)$/i) | |
return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i) | |
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"") | |
end | |
end |
This file contains 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
# config/application.rb | |
module MyApp | |
class Application < Rails::Application | |
... other configs | |
config.secondary_database_url = ENV['SECONDARY_DB_URL'] | |
end | |
end | |
We may want to override this in development / test |
This file contains 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
# Place me in config/application.rb or in your development file | |
if Rails.env.development? | |
class Hook | |
def self.delivering_email(message) | |
message.to = "\"#{message.to.first}\" <my@email.com>" | |
message.cc = nil if !message.cc.nil? | |
message.bcc = nil if !message.bcc.nil? | |
end | |
end |
NewerOlder