Skip to content

Instantly share code, notes, and snippets.

Avatar

Tomaz dcrystalj

View GitHub Profile
View subselect-presto.sql
WITH city AS (
SELECT user_id, name, moved_on,
row_number() over (partition by user_id order by moved_on desc) city_freshness
FROM location
),
latest_location AS (SELECT * FROM city where city_freshness=1)
SELECT
"user".id,
View subselect-presto-create-db.sql
CREATE SCHEMA subquery;
USE subquery;
CREATE TABLE IF NOT EXISTS "user" (
id INT,
name VARCHAR (50)
);
CREATE TABLE IF NOT EXISTS "location" (
id INT,
View subselect-pgsql-create-db.sql
CREATE DATABASE subquery
\c subquery
CREATE TABLE IF NOT EXISTS "user" (
id INT PRIMARY KEY,
name VARCHAR (50) NOT NULL
);
CREATE TABLE IF NOT EXISTS "location" (
View subselect.sql
SELECT
"user".id,
"user".name,
(
SELECT l.name
FROM location l
WHERE location.user_id=l.user_id
ORDER BY l.moved_on DESC
LIMIT 1
) current_location,
@dcrystalj
dcrystalj / promise queue
Created Apr 25, 2019
simple promise queue framework
View promise queue
export const PromiseQueue = function() {
let defered = Promise.resolve();
return {
push(fn) {
defered = defered.then(fn, fn);
return this;
}
};
};
@dcrystalj
dcrystalj / testing-vue-tree
Last active Nov 11, 2018
Testing vue tree
View testing-vue-tree
TESTING VUE:
education
Testing Vue.js Applications https://www.manning.com/books/testing-vue-js-applications
vue-test-utils docs https://vue-test-utils.vuejs.org/
vue docs https://vuejs.org/v2/guide/unit-testing.html
vuex docs https://vuex.vuejs.org/guide/testing.html
testing
View launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
View tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build & run",
"type": "shell",
"command": "g++ program.cpp -std=c++14 -o program.out && time ./program < in.txt",
"group": {
@dcrystalj
dcrystalj / cloudSettings
Last active Dec 24, 2017
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2017-12-24T08:27:36.000Z","extensionVersion":"v2.8.7"}
@dcrystalj
dcrystalj / rene descartes
Created Feb 21, 2017
Descartes reasoning in a nutshell
View rene descartes
“Descartes maintains that we cannot accept anything as being true unless we can clearly and
distinctly perceive it. To achieve this can require the breaking down of a compound problem into as
many single factors as possible. Then we can take our point of departure in the simplest idea of all.
You could say that every single thought must be weighed and measured, rather in the way Galileo
wanted everything to be measured and everything immeasurable to be made measurable. Descartes
believed that philosophy should go from the simple to the complex. Only then would it be possible to
construct a new insight. And finally it would be necessary to ensure by constant enumeration and
control that nothing was left out. Then, a philosophical conclusion would be within reach.”
“It sounds almost like a math test.”
“Yes. Descartes was a mathematician; he is considered the father of analytical geometry, and he