Skip to content

Instantly share code, notes, and snippets.

View tomitrescak's full-sized avatar
🏠
Working from home

Tomas Trescak tomitrescak

🏠
Working from home
View GitHub Profile
{
"compileOnSave": true,
"compilerOptions": {
"target": "es6",
"module": "es6",
"declaration": false,
"noImplicitAny": true,
"removeComments": false,
"noLib": false,
"preserveConstEnums": true,
import React from 'react';
import Helmet from 'react-helmet';
import { style } from 'typestyle';
import { i18n } from 'es2015-i18n-tag';
const content = style({ margin: '30px' });
export class Layout extends React.Component {
static contextTypes = {
Ui: React.PropTypes.object
import { BrowserRoute, Match, Miss } from 'react-router';
import { MainLayout, HomePage, Other } from './components';
const MatchWithMainLayout = ({ exactly, pattern, component: Component }: any) => {
return (
<Match exactly={exactly} pattern={pattern} render={(props: any) => (
<MainLayout><Component {...props} /></MainLayout>
)} />
);
};
@tomitrescak
tomitrescak / package.json
Created January 8, 2017 12:53
Webpack 2 + Typescript + React (Lite)
{
"name": "YOUR NAME",
"version": "1.0.0",
"description": "Boilerplate",
"main": "index.js",
"scripts": {
"start": "./node_modules/webpack-dashboard/bin/webpack-dashboard.js -t 'React-Redux Boilerplate' -- ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"build": "rm -rf ./build && NODE_ENV=\"production\" ./node_modules/webpack/bin/webpack.js",
"preview": "NODE_ENV=\"production\" ./node_modules/webpack-dashboard/bin/webpack-dashboard.js -t 'Preview Mode - React-Redux Boilerplate' -- ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
},
@tomitrescak
tomitrescak / server.js
Created January 8, 2017 13:20
Middleware Problem
var path = require('path');
var express = require('express');
var webpack = require('webpack');
var config = require('./webpack.config');
var app = express();
var compiler = webpack(config);
var port = process.env.PORT || 3000;
app.use(require('webpack-dev-middleware')(compiler, {
@tomitrescak
tomitrescak / server.js
Created January 8, 2017 13:37
Webpack 2 + Express + Typescript + React
var path = require('path');
var express = require('express');
var webpack = require('webpack');
var config = require('./webpack.config');
var app = express();
var compiler = webpack(config);
var port = process.env.PORT || 3000;
app.use(require('webpack-dev-middleware')(compiler, {
interface IFileOwner {
files: App.Collections.ITextFileDAO[];
}
export const ClassUtils = {
alphanumSort<T>(array: Array<T>, selector?: (obj: T) => string, sensitivity = 'base') {
return array.sort((a, b) => selector(a).localeCompare(selector(b), undefined, {numeric: true, sensitivity}));
},
indexArray(arr: any[]): any[] {
if (arr.length === 0) {
@tomitrescak
tomitrescak / log.txt
Created February 8, 2017 08:13
Wallaby Problem
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 08:11:18 GMT wallaby:project Running postprocessor
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 08:11:18 GMT wallaby:testTask Test files from affected: 0, from deleted or manually requested: 1, from recently changed: 0, from loaded by: 0, from failing: 0
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 08:11:18 GMT wallaby:project Preparing to process src/client/configs/accounts.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 08:11:18 GMT wallaby:project Preparing to process src/client/configs/apollo.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 08:11:18 GMT wallaby:project Preparing to process src/client/configs/caches.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 08:11:19 GMT wallaby:project Preparing to process src/client/configs/config.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 08:11:19 GMT wallaby:project Preparing to process src/client/configs/context.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 08:11:19 GMT wallaby:project Preparing to process src/client/configs/i18n.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 08:11:19 GMT wallaby:project Prep
@tomitrescak
tomitrescak / log.txt
Created February 8, 2017 22:56
Wallaby Performance
[Info]​​​​​ Wed, 08 Feb 2017 22:49:34 GMT wallaby:project Running postprocessor
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 22:49:34 GMT wallaby:testTask Test files from affected: 0, from deleted or manually requested: 1, from recently changed: 0, from loaded by: 0, from failing: 0
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 22:49:34 GMT wallaby:project Preparing to process src/client/configs/accounts.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 22:49:34 GMT wallaby:project Preparing to process src/client/configs/apollo.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 22:49:34 GMT wallaby:project Preparing to process src/client/configs/caches.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 22:49:34 GMT wallaby:project Preparing to process src/client/configs/config.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 22:49:34 GMT wallaby:project Preparing to process src/client/configs/context.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 22:49:34 GMT wallaby:project Preparing to process src/client/configs/i18n.js
​​​​​[Info]​​​​​ Wed, 08 Feb 2017 22:49:34 GMT wallaby:project Preparing
describe('User', () => {
describe('Profile', () => {
decorator((story) => (
<ContextProvider>
{ story() }
</ContextProvider>
));
story('Default', () => {