Skip to content

Instantly share code, notes, and snippets.

View Inviz's full-sized avatar

Yaroslaff Fedin Inviz

View GitHub Profile
SELECT assert(generate_expression(
'{"a": {"col": "abc"}}'),
'a = abc');
SELECT assert(generate_expression(
'{"a": {"not": 2}}'),
'a <> 2');
SELECT assert(generate_expression(
'{"a": {"not": [{"gt": 2}, {"lt": 2}]}}'),
'NOT (a > 2 AND a < 2)');
@Inviz
Inviz / 1.sql
Last active April 17, 2018 10:28
UPDATE accounts d
SET user_ids = user_ids_aggregated_value,
user_count = user_count_aggregated_value,
reported_user_count = reported_user_count_aggregated_value,
client_count = client_count_aggregated_value,
member_count = member_count_aggregated_value,
lead_member_count = lead_member_count_aggregated_value,
consultation_count = consultation_count_aggregated_value,
reported_consultation_count = reported_consultation_count_aggregated_value,
active_project_count = active_project_count_aggregated_value,
var email = 'abc@cde.frg'
var xhr = new XMLHttpRequest
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
try {
var response = JSON.parse(xhr.response);
} catch (e) {
var response = {
status: xhr.status,
title: xhr.response
@Inviz
Inviz / cv.txt
Created December 21, 2017 05:03
Yaroslaff Fedin's CV
====================
http://github.com/Inviz
Summary
----------------------
An application developer, web developer, and front end developer with problem solving skills, attention to detail, adaptability, and the capacity to deliver cutting-edge solutions under strict deadlines.
Strengths
var IncomingOrder = {
// NO, if channel_notification option is set `nothing`
'preference.channel_notification == "nothing"': function() {
this.set('result', false, 100)
},
// NO, if user is in dnd and message is not overriding it
'user_dnd && !message_dnd_override': function() {
this.set('result', false, 90)
},
// NO, if it's a muted @here message
// Loosely-formed runtime implementation of following action scheme:
// http://www.site.uottawa.ca/~bochmann/ELG7187C/CourseNotes/BehaviorModeling/Petri-nets/Orders%20-%20activity%20diagram.jpg
// async properties, which need some kind of outside world interaction to fill up
// - order.accepted - decided by admin
// - order.invoice - an object that holds details of payment request
// - order.payment - details of fulfilled payment
// - order.shipment - details of fulfilled shipment
// variables that can be mutated freely in runtime
Petri = function() {
this.output = this.name;
}
Petri.compile = function(functions, name) {
var struct = {}
var size = 0;
var allArgs = functions.map(function(fn) {
return fn.toString().match(/\(\s*(.*?)\s*\)/)[0].split(/\s*,\s*/).map(function(arg, index) {
if (struct[arg] == null)
describe('jot customizations', function() {
it ('splice partially remove beginning of LTR MOVE range',function() {
// short example
expect(
new jot.SPLICE(0, 1, "").compose(
new jot.SPLICE(1, 1, "")
).apply(
new jot.MOVE(1, 2, 4)
.apply('ABCDEFG')
)
@Inviz
Inviz / Readme.txt
Last active April 20, 2017 06:20
PG optimistic operational transformation setup
This postgres script provides an example for a system with
soft resolution of state change conflicts.
In this system updates do not mutate rows in tables,
instead they insert new rows retaining versioning metadata.
It is possible to restore all actions and side effects post-mortem.
A client first fetches current state of data, and receives its version id.
Client does somemething that invokes operations on that data, and changes it.
It then sends that data to server, with log of operation that led to it.
eval $meta {
set_unescape_uri $flash $arg_flash;
postgres_pass database;
postgres_output json;
postgres_query "
SELECT 'abzc' as biggles,
singularize('$resource') as singular,
(SELECT columns from structures where table_name='$resource') as columns,
nullif('$flash', '') as flash";
postgres_rewrite GET no_rows 403;