Skip to content

Instantly share code, notes, and snippets.

View s-panferov's full-sized avatar

Stanislav Panferov s-panferov

View GitHub Profile
var webpack = require('webpack');
var path = require("path");
var fs = require("fs");
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function (x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function (mod) {
{
"version": "1.5.0-beta",
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"jsx": "react",
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
@s-panferov
s-panferov / chat.ts
Created June 19, 2015 05:38
Immutable models in TS
import invariant from '../lib/invariant';
import * as models from './index';
import { Record, Map, Set, List } from 'immutable';
import { Option, Some, None } from 'opty';
export enum ChatType {
Dialog = <any>'dialog',
Room = <any>'room'
}
{
block : 'form-field',
name : 'documentUrgency',
mods : { theme : 'alfa', bkg : 'color' },
content : [
{ tag : 'br' },
{ tag : 'br' },
{ tag : 'br' },
{
block : 'checkbox',
modules.define('madison',
['log', 'config', 'utils', 'router', 'bank__auth', 'bank__customers', 'page'],
function(provide, log, config, utils, router, bankAuth, bankCustomers, page) {
var vow = require('vow'),
express = require('express'),
path = require('path'),
cookies = require('cookie-parser'),
session = require('express-session'),
body = require('body-parser');
var x = 5;
var y = 10;
with({x: 20}) {
var x = 30;
var y = 30;
console.log(x);
console.log(y);
};
state = rx.BehaviorSubject<
model_state.ModelState<
immutable.Map<
Ref,
rx.BehaviorSubject<model_state.ModelState<Model, void>>
>,
Meta
>
>;
export interface ModelState<Model> {
model: opty.Option<Model>;
isProcessing: boolean;
isPending: boolean;
}
export interface ListModel<Ref, Model, Meta> {
models: immutable.Map<Ref, rx.BehaviorSubject<ModelState>>;
meta: opty.Option<Meta>;
}
private dispatchLoadOrgs(action: org_actions.LoadOrgs.Start) {
loadOrgsLock.lock(action.actionId, api.requestManager);
org_api.OrgApi
.loadOrgs(action.actionId)
.then((reply) => {
loadOrgsLock.unlock();
this.dispatcher.dispatch(new org_actions.LoadOrgs.Complete(action, reply.orgs))
})
.catch((e) => {
var viewClass = bemr.block("card");
return DOM.div({className: viewClass},
DOM.div({className: viewClass.el("cover")},
avatar.AvatarF({
url: "/public/profile.png",
variant: avatar.Variant.Large,
className: viewClass.el("avatar")
}),
DOM.div({className: viewClass.el("name")}, user.name)