Skip to content

Instantly share code, notes, and snippets.

Yaroslaff Fedin Inviz

Block or report user

Report or block Inviz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View query_gen.sql
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)');
View 1.sql
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,
View gist:975bfd891523efdfcd09c77d3e0440dd
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
View cv.txt
Yaroslaff Fedin's CV
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.
View channel_notifications.js
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
View invoice petri g.js
// Loosely-formed runtime implementation of following action scheme:
// 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
View petri-struct.js
Petri = function() {
this.output =;
Petri.compile = function(functions, name) {
var struct = {}
var size = 0;
var allArgs = {
return fn.toString().match(/\(\s*(.*?)\s*\)/)[0].split(/\s*,\s*/).map(function(arg, index) {
if (struct[arg] == null)
View MOVE-SPLICE-jot.js
describe('jot customizations', function() {
it ('splice partially remove beginning of LTR MOVE range',function() {
// short example
new jot.SPLICE(0, 1, "").compose(
new jot.SPLICE(1, 1, "")
new jot.MOVE(1, 2, 4)
Inviz / Readme.txt
Last active Apr 20, 2017
PG optimistic operational transformation setup
View Readme.txt
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.
View auth.conf.sql
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;
You can’t perform that action at this time.