Skip to content

Instantly share code, notes, and snippets.

import {Context} from 'koa';
import Router from 'koa-router';
import db from '../db/connection';
import {getAuth} from './session';
import {validationFailed} from './errors';
import {User} from '../db/users';
import {IBaseProtocol} from 'pg-promise';
import * as t from 'io-ts';
import koaBody from 'koa-body';
import * as t from 'io-ts';
import {DateFromISOString} from 'io-ts-types/lib/Date/DateFromISOString';
const Type = t.type({
time: DateFromISOString
});
console.log(Type.decode({time:'2018-05-18T12:43:55.709Z'}));
WITH RECURSIVE folder_tree(id, depth) AS (
SELECT
fo.id,
1
FROM
folder AS fo
WHERE (
(${ids}::bigint[] IS NULL AND fo.parent_folder_id IS NULL)
OR fo.id = ANY (${ids}::bigint[])
) AND fo.user_group_id = ${userGroupId}
service: backend
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: eu-west-1
# you can add statements to the Lambda function's IAM Role here
declare module 'serverless-http' {
import {Express} from 'express';
type Handler = (input:any) => any;
function mkHandler(app:Express):Handler;
export = mkHandler;
}
server {
listen 80;
server_name app.oma-domain.fi;
root /var/www;
location =/ {
rewrite ^ https://app.oma-domain.fi$request_uri? permanent;
}
}
server {
listen 443 ssl; # managed by Certbot
package db
import (
"github.com/jmoiron/sqlx"
"github.com/lib/pq"
"gopkg.in/guregu/null.v3"
"pipekeeper/testutil"
"testing"
)
package db
import (
"github.com/jmoiron/sqlx"
"github.com/lib/pq"
"gopkg.in/guregu/null.v3"
)
type UserGroup struct {
Id int64
import * as crud from './crud';
import configureMockStore from 'redux-mock-store';
import createSagaMiddleware from 'redux-saga';
import {select, put, call} from 'redux-saga/effects';
interface Dummy {
id: string;
name: string;
}
import * as crud from './crud';
import {RootState} from '../reducers';
export interface Query {
offset?: number;
limit?: number;
}
export interface Project {
id: string;
name: string;