Skip to content

Instantly share code, notes, and snippets.

View stelf's full-sized avatar
🦌
focusing 🦊

Gheorghi stelf

🦌
focusing 🦊
View GitHub Profile
@stelf
stelf / async.dom.dfs.js
Created November 26, 2014 17:46
async DOM dfs
(function() {
var aval = 'val';
var res = [];
Q.longStackSupport = true;
console.log('start dfs');
function dfs(elem, level) {
console.log('ENTER: ' + elem.tagName + ' level: ' + level + ' elem has ' + elem.childNodes.length + ' children');
@stelf
stelf / inifinite.stream.js
Created November 27, 2014 10:36
infinite stream in JS
// Infite stream implementation with Basic promises.
// inspired by
// http://perl.plover.com/Stream/stream.html#streams
var Stream = function(_head, _tail) {
this.h = _head;
this.t = _tail;
};
@stelf
stelf / tiny.rpn.calc.cpp
Created October 22, 2015 08:59
tiny rpn calculator
// rpn.cpp : micro example of RPN calculator
//
#include "stdafx.h"
#include <stack>
#include <iostream>
using namespace std;
char * rpns[] = {
@stelf
stelf / inc-all-seq.sql
Created March 1, 2017 09:33
update all sequences with some value in postgresql
create or replace function update_all_seqs(inc integer) returns void as $$
DECLARE
r pg_class%rowtype;
i name;
isit integer;
BEGIN
FOR i in SELECT c.relname from pg_class c where c.relkind = 'S' LOOP
isit := POSITION('pv_' in i);
IF (isit = 1) THEN
execute 'select last_value from visionr.' || i into isit;
#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------
#
# this is from a Windows Server 2008
# with 2 drives in SAS array
# and 32 GB of memory
# memory consumption
@stelf
stelf / inmaintbl-migrate.sql
Created April 11, 2017 21:01
update VISIONR inmaintbl schema from 'false' to 'true'
UPDATE
visionr.pv_m_itm iout
SET
protocol_stock = (
select
child_object
from
visionr.pv_m_rel_1_n
where
for v in $(find . | egrep \\\.xml); do
xmlstarlet sel -t -c "//*[is_unique='false' and is_multiple='true']" $v;
done
<objectdefs>
<most module_alias="m" use_prefix="true">
<protocol_return parent_objectdef="most.protocol_stock">
<ref_sale>
<category>most.related.protocols</category>
<sort_id>189</sort_id>
<data_source>relation</data_source>
<is_obligatory>false</is_obligatory>
<is_inmaintbl>true</is_inmaintbl>

задачи (без обобщение / aggregate ):

  1. да се изведат имената и годината на производство на всички филми издадени м/у 1980 и 1995 година
SELECT 
	TITLE, YEAR
FROM
	MOVIE
WHERE 
function logsz(odef) {
var sz = odef.SELECT().VALUE.size;
java.log.info(odef + ".size == " + sz);
}
function test_h2() {
java.log.info("=== collection sizes === ");
logsz4all();
var pro = db.most.protocol.INSTANCES["INV0005891430/40"];
var dold = pro.official_date;