Skip to content

Instantly share code, notes, and snippets.

should "return only matched non-duplicated clients" do
create_list :client, 2
rob_rogers = create :client, full_name: "Rob Rogers"
rob_holmes = create :client, full_name: "Rob Holmes"
suspended_client = create :client, :cancelled
create(:score_tracker, client: rob_rogers)
3.times { create(:followup_callback, client: rob_holmes) }
4.times { create(:followup_callback, client: suspended_client) }
@jzajpt
jzajpt / available_numbers.txt
Created May 26, 2020 14:43
Available phone numbers
Region: Area Code
NJ: 201
DC: 202
CT: 203
MB: 204
AL: 205 +12052935417, +12052935414
WA: 206 +12069847434, +12069847167, +12069847324, +12069847451, +12069847157
ME: 207 +12077088049, +12077427784, +12077078961, +12077088089, +12077427614
ID: 208 +12083286990, +12083286796, +12083286887, +12083286945, +12083475493
CA: 209 +12093701410, +12093701402, +12093701466, +12093700958, +12093701473

Programming Exercise - Grouping

The goal of this exercise is to identify rows in a CSV file that may represent the same person based on a provided Matching Type (definition below).

The resulting program should allow us to test at least three matching types:

  • one that matches records with the same email address
  • one that matches records with the same phone number
  • one that matches records with the same email address OR the same phone number
# == Schema Information
#
# Table name: chargebee_invoices
#
# id :bigint not null, primary key
# client_id :bigint
# created_at :datetime not null
# updated_at :datetime not null
# chargebee_id :string
# chargebee_data :jsonb

Keybase proof

I hereby claim:

  • I am jzajpt on github.
  • I am jzajpt (https://keybase.io/jzajpt) on keybase.
  • I have a public key ASBSW5mYrXz_cNajcYu6s8QLEjN4nGwCkCqP5RbS7fbVVgo

To claim this, I am signing this object:

@jzajpt
jzajpt / gist:5830058
Last active January 13, 2022 00:44
HTML 5 Pages API

HTML 5 API

Available routes

Request

GET /mobile/routes

Response

{
 "home_path":"/mobile/home?game_id=:game_id&latitude=:gps_latitude&longitude=:gps_longitude",
@jzajpt
jzajpt / gist:2996464
Created June 26, 2012 15:35
Rails controllers - No caching
before_filter :set_caching_headers
def set_caching_headers
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "0"
end
@jzajpt
jzajpt / daily_iterator.rb
Created March 14, 2012 09:07
Classes for pulling statistics data from Rails models
# encoding: utf-8
class Statistics::DailyIterator
def initialize(period_start = nil, period_end = nil)
@period_start = (period_start || 30.days.ago).to_date
@period_end = (period_end || 1.day.ago).to_date
end
def each(&block)
period = @period_start..@period_end
@jzajpt
jzajpt / gist:1826036
Created February 14, 2012 11:33 — forked from zachy/gist:1825836
require 'imgkit'
class InvalidInputFileError < Exception; end
class Converter
def initialize(input, output = nil)
raise InvalidInputFileError unless html_file?(input)
@input = input
if @output
@ouput = output
@jzajpt
jzajpt / object_id_encode.js
Created February 2, 2012 20:00
Encode & decode BSON::ObjectId into more friendly format (base64-like)
class ObjectIdEncoder
attr_accessor :id
def initialize(id)
@id = id.to_a
raise "invalid ID!" unless @id.size == 12
end
def encode
result = []