Skip to content

Instantly share code, notes, and snippets.

import Validation, { Success, Failure } from 'data.validation'
// დატა ფილდები ინტელისენსისთვის
interface Validator<T, V> {
criteria: T,
fieldName: String,
value: V,
result(): Validation,
}
@notgiorgi
notgiorgi / ap.md
Last active May 5, 2017 08:29
applicative validation

haskell (its kind of pseudo-code)

data Person = Person String String

liftA2 Person (Just "George") (Just "Martin")
-- is same as
Person <$> (Just "George") <*> (Just "Martin")
-- evaluation steps:
Just (\surname -> Person "George" surname) <*> (Just "Martin")
Just (Person "George" "Martin")
@notgiorgi
notgiorgi / monads.txt
Created May 3, 2017 17:28 — forked from jhrr/monads.txt
"Programming with Effects" by Graham Hutton -- http://www.cs.nott.ac.uk/~gmh/monads
PROGRAMMING WITH EFFECTS
Graham Hutton, January 2015
Shall we be pure or impure?
The functional programming community divides into two camps:
o "Pure" languages, such as Haskell, are based directly
upon the mathematical notion of a function as a
mapping from arguments to results.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@notgiorgi
notgiorgi / DataTable.ts
Created April 16, 2017 13:18 — forked from cschmidli/DataTable.ts
Semantic UI Data Table Component
import * as React from 'react';
import * as hash from 'object-hash';
import {
TableProps,
Table,
TableBody,
TableCell,
TableFooter,
TableHeaderCell,
import React, { Component, PropTypes } from 'react'
import { Table, Menu, Icon, Segment, Input } from 'semantic-ui-react'
class TableElement extends React.Component {
constructor(props) {
super(props);
this.data = props.data
this.renderRow = props.renderBodyRow || this.defaultRenderBodyRow
this.headerRow = props.headers || Object.keys(this.data.pop());
this.currentIndex = 0
@notgiorgi
notgiorgi / sum_product.md
Last active February 22, 2017 18:58
Sum and Product types
  1. In type theory a Product type is a type made of a set of types compounded over each other. In Haskell we represent products using tuples or data constructors with more than one argument. The “compounding” is from each type argument to the data constructor representing a value that coexists with all the other values simultaneously. Products of types represent a conjunc- tion, “and,” of those types. If you have a product of Bool and Int, your terms will each contain a Bool and Int value.
  2. In type theory a Sum type of two types is a type whose terms are terms in either type, but not simultaneously. In Haskell sum types are represented using the pipe, |, in a datatype definition. Sums of types represent a disjunction, “or,” of those types. If you have a sum of Bool and Int, your terms will be either a Bool value or an Int value.
window.audioContext = window.audioContext||window.webkitAudioContext; //fallback for older chrome browsers
var context = new AudioContext();
context.createGain = context.createGain||context.createGainNode; //fallback for gain naming
var gainL = context.createGain();
var gainR = context.createGain();
var splitter = this.context.createChannelSplitter(2);
//Connect to source
const { DataTypes } = require('sequelize')
module.exports = {
schema: {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
autoIncrement: true,
},
const webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
// your wp config lives here
const config = require('./webpack.config')
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,