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
require "test/unit" | |
def chop(int, array_of_int) | |
end | |
# http://codekata.com/kata/kata02-karate-chop/ | |
class ChopTest < Test::Unit::TestCase | |
def test_chop | |
assert_equal(-1, chop(3, [])) | |
assert_equal(-1, chop(3, [1])) |
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 Task | |
def due_date | |
@due_date = DueDate.new(self) | |
end | |
end | |
class DueDate | |
def initialize(task) | |
@task = task | |
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
name | ring | quadrant | isNew | description | |
---|---|---|---|---|---|
Stimulus | Adopt | Langages and frameworks | TRUE | Stimulus is a JavaScript framework with modest ambitions. It doesn’t seek to take over your entire front-end—in fact, it’s not concerned with rendering HTML at all. Instead, it’s designed to augment your HTML with just enough behavior to make it shine | |
Test context for stimulus tests | Assess | Techniques | TRUE | Some stimulus tests can result in setup contain several lines of html that is required to be setup differently for each test. Using test context can reduce the duplication of code and produce easier to maintain tests | |
Github projects | Trial | Platforms | TRUE | Some teams have been using github projects as an alternative to trello for managing projects and tracking work. The tighter integration with issue and pull requests makes it easier to link work together within the team | |
React with Redux | Hold | Tool | TRUE | React and Redux has been in the app for some time however we now feel its apporach to dealing with front-end interactivity adds s |
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
const config = { attributes: true, childList: true, subtree: true } | |
const callback = (mutationsList : any) => { | |
mutationsList.forEach((mutation : MutationRecord) => { | |
if (mutation.type === "childList") { | |
if (mutation.target.nodeName.toLowerCase() === "form") { | |
mutation.target.dataset.turbo = false | |
} else { | |
if (mutation.target.dataset.turbolinks) { | |
mutation.target.dataset.turbo = mutation.target.dataset.turbolinks |
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
/* eslint import/first: off */ | |
/* eslint import/extensions: off */ | |
process.env.NODE_ENV = process.env.NODE_ENV || "development" | |
import environment from "./environment.mjs" | |
export default environment({ | |
path: "packs", | |
}) |
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
#!/usr/bin/env ruby | |
# == Synopsis | |
# This is a simple script to export a single FreeAgent company | |
# as a SQL script file to reload on an alternate server | |
# | |
# == Examples | |
# This command exports company with id=1 to the file 1.sql | |
# company-export 1 | |
# |
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
def invoices_with_incorrect_deductions | |
filename = "invoices_with_incorrect_deductions" | |
invoices = Invoice.where("discount_percent > 0 AND cached_cis_deduction > 0") | |
writer = Metrics::CsvFileWriter.new(filename) | |
progress_bar = ProgressBar.new(invoices.count) | |
writer.open_csv_for_write do |csv| |
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
def backfill_bill_items | |
bills = Bill.all | |
progress_bar = ProgressBar.new(bills.count) | |
# Keeping the batch size low to reduce the time we are locking the 100 records | |
# for update | |
bills.select( | |
:id, | |
:contact_id, |
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
def fix_sent_invoices(company_id, reference) | |
company = Company.find(company_id) | |
invoices = company.invoices.where(company_id: company_id, reference: reference) | |
return "Only #{invoices.length} found" if invoices.length < 2 | |
puts "update #{invoices.length} invoices (#{invoices.map(&:id).join(",")}) for #{company.subdomain}?" | |
confirm = gets.chomp | |
return unless confirm == "y" |
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
require "perform_on_replica" | |
def find_duplicate_references | |
PerformOnReplica.perform_on_replica do | |
companies = Company.all | |
progress_bar = ProgressBar.new(companies.count) | |
companies.includes(:subscription).find_each do |company| | |
references = company.invoices. | |
group(:reference). |
NewerOlder