Skip to content

Instantly share code, notes, and snippets.

View nc-lot's full-sized avatar

Thomas Lo nc-lot

  • Nextcapital Group
  • Chicago, IL
View GitHub Profile
@nc-lot
nc-lot / curl_rails_c.txt
Last active January 25, 2017 17:32
Test rails controllers with curl in rails console
First login user #=> this will store a valid API key in current session
$ app.post 'api/users/login', { login: 'user login', password: "user password" }
status of 200 means it's been successful
You can now make a request to the route/action you're trying to test.
i.e. $ app.post 'api/accounts/manual', params #=> this tests the manual_accounts#create
* remember to run rake tasks
rake:schema:load
rake:db:test:prepare # test
@nc-lot
nc-lot / git_gist.txt
Last active January 25, 2017 17:31
Rebasing to re-order/squash/fix-up/edit commits
git rebase -i HEAD~N // where N is number of prev commits you want to use
e.g. git rebase -i HEAD~3 // returns last 3 commits
p commit1 (3rd latest)
p commit2
p commit3 (latest)
re-ordering the latest with the 3rd latest
@nc-lot
nc-lot / gist:15d95fc96602aebbe8063048f18ec31f
Created February 6, 2018 00:06
Setting up rki-john-hancock-mapping.md
## Prelimininary Setup
* Download and install
@nc-lot
nc-lot / gist:5f9796a661c09e48b1e78a0f3b180e24
Last active November 15, 2018 16:47
Advice Generation for Bulk Enrollment Proof of concept
# BulkEnrollmentPortfolioAdviceTemplate
module Advice
module Templates
class BulkEnrollmentPortfolioAdviceTemplate < PortfolioAdviceTemplate
def accounts
@accounts, @considered_accounts = super.partition do |account|
options[:target_account_ids].include?(account.id)
end
@accounts
end
@nc-lot
nc-lot / date_mismatch_spec.gist
Last active May 14, 2019 15:21
A small contrived example of how dates can change during specs and cause issues
class DateClass
def current
Date.current
end
end
describe DateClass do
describe "#current" do
it "returns the current date" do
expected_date = Date.current # created at 23:59:59
@nc-lot
nc-lot / gist:326195b514b478191a156baefb700a7e
Last active May 6, 2021 16:04
possible duplicate ach instructions query
def possible_duplicate_ach_instructions_workflow
completed_link_workflows = RegisterLinkWorkflow.where(status: "in_progress")
duplicate_link_workflows = completed_link_workflows.select do |link_workflow|
user = link_workflow.user
link = link_workflow.link
managed_account = link.first_account
bank_account = link.second_account
managed_account
.account_links