Skip to content

Instantly share code, notes, and snippets.

View tadjik1's full-sized avatar
:octocat:
🐛 🔫 🤠

Sergey Zelenov tadjik1

:octocat:
🐛 🔫 🤠
View GitHub Profile
localStorage.setItem("item", "item");
// current
const [rendered, type] = await (async () => {
const articleRenderer = new ArticleRenderer();
const taskRenderer = new TaskRenderer();
if (doc instanceof Article) {
return [await articleRenderer.render(doc), 'article'];
} else if (doc instanceof Task) {
return [await taskRenderer.render(doc), 'task'];
@tadjik1
tadjik1 / koa.js
Created March 27, 2017 16:19
simple koajs implementation
const {Server} = require('http');
class KoaError extends Error {
constructor(status, message) {
super(message);
this.status = status;
}
}
module.exports = class Koa {
@tadjik1
tadjik1 / encoder.scala
Created March 21, 2017 10:11
small example of polymorphic encoders
trait Encoder[From] {
type To
def encode(from: From): To
}
object Encoder {
type Aux[From, To0] = Encoder[From] {
type To = To0
}
implicit def compose[A, B, C](implicit e1: Encoder.Aux[A, B], e2: Encoder.Aux[B, C]): Encoder.Aux[A, C] =
new Encoder[A] {
@tadjik1
tadjik1 / Link.elm
Last active December 4, 2016 22:43
Elm component realised <Link> component from react-router
@tadjik1
tadjik1 / 1.js
Last active April 26, 2016 20:48
class List extends Component {
constructor(props) {
super(props);
this.state = {
list: [1, 2, 3, 4, 5]
};
}
render() {
import React, { Component } from 'react';
import { render } from 'react-dom';
import { times, uniqueId } from 'lodash';
class Fruite {
constructor(name) {
this.id = uniqueId();
this.name = name;
}
@tadjik1
tadjik1 / webpack.config.js
Created December 25, 2015 14:02
webpack.config.js
import path from 'path';
import webpack, { DefinePlugin, BannerPlugin } from 'webpack';
import merge from 'lodash/object/merge';
import autoprefixer from 'autoprefixer';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import minimist from 'minimist';
import { getTemplates } from './html';
const parameters = minimist(process.argv.slice(2))._;
it('should return response', async () => {
const result = await API.get('/test', {});
expect(result).to.deep.equal({hello: 'world', meta: {status: 200}});
});
@tadjik1
tadjik1 / gist:5b52176de35eecdb3e28
Last active November 2, 2015 10:08
Dockerfile
# Dockerfile for %example% project
FROM centos:centos7
MAINTAINER Sergey Zelenov <[email protected]>
RUN yum update -y
# Install EPEL
RUN yum install -y epel-release