Skip to content

Instantly share code, notes, and snippets.

View HaruKawamata's full-sized avatar

Haru Kawamata HaruKawamata

View GitHub Profile
@HaruKawamata
HaruKawamata / square.rb
Created March 6, 2025 05:10
Square Data Stream Integration
# typed: true
# frozen_string_literal: true
module DataStreamSyncer
class Square < ::DataStreamSyncer::Base
# the square syncer should run every SYNC_FREQUENCY minutes
# this overrides DSS::Base
def should_sync_at?(_time)
true
end
all_rulesets.select do |ruleset|
const ato_overlap = ruleset.award_template_organisation_ids.blank? ||
ruleset_trying_to_be_saved.award_template_organisation_ids.blank? ||
(ruleset.award_template_organisation_ids & ruleset_trying_to_be_saved.award_template_organisation_ids).present?
const tag_overlap = ruleset.award_tag_ids.blank? ||
ruleset_trying_to_be_saved.award_tag_ids.blank? ||
(ruleset.award_tag_ids & ruleset_trying_to_be_saved.award_tag_ids).present?
schedules.filter(
(sched) => schedules.none(
(sched_to_compare) => sched.id !== sched_to_compare.id &&
(sched.start == sched_to_compare.finish || sched.finish == sched_to_compare.start)
)
)
`insert into "user_words" ("proficiency", "result_ids", "user_id", "word_id") values (1, '{256}', 1, 1) ON CONFLICT (user_id, word_id) UPDATE user_words SET "user_id" = 1, "word_id" = 1, "proficiency" = 1, "result_ids" = '{256}' where user_words.word_id = 1 AND user_words.user_id = 1 - syntax error at or near "UPDATE"`
ruby@hugokawamata-dev-server:~/core/repo$ RAILS_ENV=test TEST_ENV_NUMBER=2 bundle exec parallel_test $(cat .circleci/parallel_test_cli_opts_ruby_2)
2 processes for 337 tests, ~ 168 tests per process
Loading env variables in env: test at 2020-04-22 00:05:23 +0000
Local mode: true
Loading env variables in env: test at 2020-04-22 00:05:23 +0000
Local mode: true
Traceback (most recent call last):
22: from -e:1:in `<main>'
21: from -e:1:in `each'
20: from -e:1:in `block in <main>'
<ShiftOptions
automaticBreakLength={30}
breaks={[]}
cancelSwapPlan={() => (new Promise(() => {}))}
cost={150}
finish={MONDAY_3PM}
locale="en"
location="Sector V Treehouse"
/* $FlowFixMe */
intl={null}
from gurobipy import *
import random
# Data and ranges
nHospitalSites = 30
nSuburbs = 55
MaxSuburbsPerHospital = 7
MaxPopulation = 500000
H = range(nHospitalSites)
package week4;
import java.util.ArrayList;
import java.util.List;
/**
* Represents an immutable polynomial with integer coefficients (and a single
* indeterminate "x"). A typical polynomial is 5x^2 + 3x + 2.
*/
public class Polynomial {