Skip to content

Instantly share code, notes, and snippets.

View fl00r's full-sized avatar

Peter Yanovich fl00r

  • Integrity
  • Tel Aviv
View GitHub Profile
class Player
def play_turn(warrior)
@max_health ||= warrior.health
case state(warrior)
when :lost
warrior.pivot!
when :captive
warrior.rescue!
when :enemyfar
small = (1..10).to_a
big = (1..5_000).to_a
Fiber.new do
puts "It's ok"
puts *small
puts "It is not ok"
puts *big
end.resume
@fl00r
fl00r / quartz_jdbc_store.sql
Last active August 29, 2015 14:26 — forked from ajbrown/quartz_jdbc_store.sql
The following script creates the schema required to use Postgres as the JDBC store for clustering Quartz. This was tested on Quartz 2.2.1 in Postgres 9.1 and 9.3
DROP TABLE qrtz_blob_triggers;
DROP TABLE qrtz_calendars;
DROP TABLE qrtz_cron_triggers;
DROP TABLE qrtz_fired_triggers;
DROP TABLE qrtz_job_details CASCADE;
DROP TABLE qrtz_locks;
DROP TABLE qrtz_paused_trigger_grps;
DROP TABLE qrtz_scheduler_state;
DROP TABLE qrtz_simple_triggers;
DROP TABLE qrtz_simprop_triggers;
@fl00r
fl00r / trie.lua
Created October 28, 2016 11:17
Trie
properties = box.schema.space.create('properties')
properties:create_index('primary', {parts = {1, 'str'}, type = 'HASH', unique = true, if_not_exists = true})
properties:replace({'node_id', 0})
nodes = box.schema.space.create('nodes')
nodes:create_index('primary', {parts = {1, 'num', 2, 'str'}, type = 'TREE', unique = true, if_not_exists = true})
function load_words()
local words = "/opt/dict/words"
for line in io.lines(words) do