Skip to content

Instantly share code, notes, and snippets.

import * as fdb from 'foundationdb';
require('segfault-handler').registerHandler();
fdb.setAPIVersion(600);
main().catch(err => console.error(err));
async function main() {
const db = (await fdb.open()).withKeyEncoding(fdb.encoders.tuple);
@aikoven
aikoven / router.py
Last active September 21, 2018 04:28
Ice server with Node.js
import signal
import sys
import os
import subprocess
import Ice
class Forwarder(Ice.BlobjectAsync):
"""
Forwards incoming requests to Node.js server
// Type definitions for react-redux 2.1.2
// Project: https://github.com/rackt/react-redux
// Definitions by: Qubo <https://github.com/tkqubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../react/react.d.ts" />
/// <reference path="../redux/redux.d.ts" />
declare module "react-redux" {
import { Component, ComponentClass, StatelessComponent } from 'react';
import gulp from 'gulp';
import ts from 'gulp-typescript';
import babel from 'gulp-babel';
import mocha from 'gulp-spawn-mocha';
gulp.task('build', () => {
return gulp.src(['typings/tsd.d.ts', 'src/**/*.ts', 'test/**/*.ts'])
.pipe(ts({
target: 'ES6',
outDir: 'build'
import {hello} from '../src/hello';
import * as assert from 'assert';
describe('hello', () => {
it('should capitalize the name', () => {
assert.equal("Goodbye, John", hello('john'));
});
});
import gulp from 'gulp';
import ts from 'gulp-typescript';
import babel from 'gulp-babel';
gulp.task('build', () => {
return gulp.src(['typings/tsd.d.ts', 'src/**/*.ts'])
.pipe(ts({
target: 'ES6',
outDir: 'build'
}))
import {capitalize} from 'lodash';
export function hello(name:string) {
return `Hello, ${capitalize(name)}`;
}
@aikoven
aikoven / gulpfile.babel.js
Last active October 4, 2015 12:29
ES6 Gulp config
import gulp from 'gulp';
gulp.task('defalut', () => {
// ...
});
@aikoven
aikoven / switch_layout.py
Created February 25, 2014 07:51
Switch input text layout
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import codecs
DVORAK = ur"§[]',.pyfgcrl/=aoeuidhtns-\`;qjkxbmwvz" ur'±!@#$%^&*(){}"<>PYFGCRL?+AOEUIDHTNS_|~:QJKXBMWVZ'
RUSSIAN = ur"ё-=йцукенгшщзхъфывапролджэ\]ячсмитьбю." ur'Ё!"№;%:?*()_+ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭ/[ЯЧСМИТЬБЮ,'
LAYOUTS = (DVORAK, RUSSIAN)
@aikoven
aikoven / parametric_tests.py
Created January 26, 2012 04:49
Decorators for parametric unit tests in Python
from types import FunctionType
__author__ = 'Daniel Lytkin'
def parameters(paramsList, naming = None):
"""Generates test method for every param in paramsList.
If 'naming' argument provided, new methods are named as naming(param).
Wrapped method must have one argument param
Usage: