Skip to content

Instantly share code, notes, and snippets.

View stepancar's full-sized avatar
🎯

Stepan Mikhailiuk stepancar

🎯
View GitHub Profile
<div
class="left">
Left passed content here
<ng-content
select="[left]">
</ng-content>
</div>
/**
* An *action* is a plain object that represents an intention to change the
* state. Actions are the only way to get data into the store. Any data,
* whether from UI events, network callbacks, or other sources such as
* WebSockets needs to eventually be dispatched as actions.
*
* Actions must have a `type` field that indicates the type of action being
* performed. Types can be defined as constants and imported from another
* module. It's better to use strings for `type` than Symbols because strings
* are serializable.
// ДЕЛАЕМ ГОВНО ЧТОБ НЕ БЫЛО ГОВНА
const fs = require('fs');
const Path = require('path');
if (!String.prototype.splice) {
String.prototype.splice = function(start, delCount, newSubStr) {
return this.slice(0, start) + newSubStr + this.slice(start + Math.abs(delCount));
};
}
function readDirR(dir) {
return (fs.statSync(dir).isDirectory() && !dir.endsWith('wscommontypes10'))
function getDtsContent(doc) {
console.log(doc.props)
return (`
import { Component } from 'react';
${doc.composes.map(({ componentName, filePath }) =>
`import { ${componentName}Props } from './${path.relative(path.dirname(doc.filePath), filePath )}'`
)}
export interface ${doc.componentName}Props ${doc.composes.length > 0? `extends ${doc.composes.map(({componentName}) => `${componentName}Props`).join(' & ')}`: ''}{
${Object.keys(doc.props).map(propName => {
import { Component } from 'react';
import { Store, Dispatch, ActionCreator } from 'redux';
import { connect as reduxConnect} from 'react-redux';
export class ElementClass<P, S> extends Component<P, S> { }
export interface ClassDecorator<P, S, T> {
<P, S, T extends constructorof<ElementClass<P, S>>>(component: T): T
}
interface MapStateToProps<P> {
(state: any, ownProps?: any): P;
}
export function connect<P,S,T extends constructorof<ElementClass<P,S>>>(mapStateToProps?: MapStateToProps<P>,
mapDispatchToProps?: MapDispatchToPropsFunction|MapDispatchToPropsObject,
mergeProps?: MergeProps,
options?: Options): ClassDecorator<P,S,T>;
interface SyncAction {
type: any;
}
interface AsyncAction {
(dispatch: (action: SyncAction | AsyncAction)=> any, getState:()=> AppState): void
}
import * as React from 'react';
import * as Dropzone from 'react-dropzone';
class DropzoneDemo extends React.Component<{}, {}> {
onDrop(files) {
console.log('Received files: ', files);
}
render() {
return (
// Type definitions for react-dropzone
// Project: https://github.com/paramaggarwal/react-dropzone
// Definitions by: Mathieu Larouche Dube <https://github.com/matdube>
// Definitions: https://github.com/Vooban/DefinitelyTyped
///<reference path='../react/react.d.ts' />
declare module ReactDropzone {
import React = __React;
interface DropzoneProps {
var webpack = require("webpack");
module.exports = {
entry: {
vendorJquery: ['jquery'], // names of modules (name of module, which u use for import statement in ts/js)
vendorReact: ['react', 'react-dom'], // names of modules (name of module, which u use for import statement in ts/js)
app: './scripts/app/app.tsx',
models: "./scripts/models/country.ts",
components: ["./scripts/components/countryTable.tsx", "./scripts/components/countryTableRow.tsx"],
},