Skip to content

Instantly share code, notes, and snippets.

View apolishch's full-sized avatar

Abraham apolishch

  • Babylon Health
  • London
View GitHub Profile
app.directive('sortable', [->
sortClasses =
'-1': 'sort-up'
'1': 'sort-down'
restrict: 'A'
scope: {
biDirectional: '@'
initialDirection: '@'
sortEventType: '@'

Keybase proof

I hereby claim:

  • I am apolishch on github.
  • I am apolishc (https://keybase.io/apolishc) on keybase.
  • I have a public key ASClCchJP326w3B-N3XuLYbQqnkKHCWiv5c5f2T_20yn_Ao

To claim this, I am signing this object:

self.game.turn = (self.game.turn == self.game.white_player_id) ? self.game.black_player_id : self.game.white_player_id
self.game.save!
if (self.game.turn == self.game.white_player_id)
self.game.turn = self.game.black_player_id
else
self.game.turn = self.game.white_player_id
end
self.game.save!
it "validates correct player's turn" do
mygame = FactoryGirl.create(:game)
anna = FactoryGirl.create(:user)
opponent = FactoryGirl.create(:user)
mygame.white_player_id = anna.id
mygame.black_player_id = opponent.id
mygame.save!
pawn = FactoryGirl.create(:pawn, game: mygame, user: anna)
sign_in anna
# pawn = create(:pawn, game: game, user_id: game.white_player_id)
@apolishch
apolishch / policy_migration1.js
Last active August 12, 2019 23:12
policy_migration1.js
export const up = (db, callback) => db.runSql(`
CREATE TABLE IF NOT EXISTS flock_policies.policies (
id bigint NOT NULL PRIMARY KEY DEFAULT nextval('flock_policies.policy_ids')
);
`, callback)
export const up = (db, callback) => db.runSql(`
CREATE TABLE IF NOT EXISTS flock_payments.payments(
id bigint NOT NULL PRIMARY KEY,
policy_id bigint NOT NULL REFERENCES flock_policies.policies (id)
);
`, callback)
@apolishch
apolishch / policy_migration2.js
Last active August 12, 2019 23:22
policy_migration2.js
export const up = (db, callback) => db.runSql(`
ALTER TABLE flock_payments.payments
DROP CONSTRAINT payments_fkey;
ALTER TABLE flock_policies.policies
ALTER COLUMN id TYPE INT;
ALTER TABLE flock_payments.payments
ALTER COLUMN policy_id TYPE INT;
@apolishch
apolishch / installpgtap
Created August 13, 2019 00:55
installpgtap
#!/bin/bash
yes | sudo cpan TAP::Parser::SourceHandler::pgTAP
code=$?
if [[ $code -eq 0 ]] ; then
echo "0"
elif [[ $code -eq 141 ]] ; then
echo "141"
else
@apolishch
apolishch / package.json
Created August 13, 2019 01:19
package.json bin
"bin": {
"installpgtapci": "bin/installpgtapci"
}
@apolishch
apolishch / package.json
Created August 13, 2019 01:26
package.json test
"scripts": {
"test": "pg_prove -U $FLOCK_PG_USERNAME -d $FLOCK_PG_DATABASE tests/*.sql tests/**/*.sql local-tests/*.sql"
}