This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import * as ReactRedux from "react-redux"; | |
interface ICity { | |
cityName: string; | |
img: string; | |
} | |
// Action Creator | |
export const getCityInformation = () => ({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MouseOverComponent extends React.Component { | |
componentDidMount() { | |
this.mouseMove$ = Rx.Observable.fromEvent(this.mouseDiv, "mousemove") | |
.throttleTime(1000) | |
.subscribe(() => console.log("throttled mouse move")); | |
} | |
componentWillUnmount() { | |
this.mouseMove$.unsubscribe(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Xunit; | |
// Tests for EventAggregator.cs (https://gist.github.com/mikebridge/f6799ebed20160f72a3daf62f584d2ff) | |
namespace Messaging.Tests.Unit | |
{ | |
public class EventAggregatorTests : IDisposable | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Reactive.Linq; | |
using System.Reactive.Subjects; | |
// inspired by https://github.com/shiftkey/Reactive.EventAggregator/blob/master/src/Reactive.EventAggregator/EventAggregator.cs | |
namespace Messaging | |
{ | |
public interface IEventAggregator : IDisposable | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// A TypeScript template for generating a Redux Test in IntelliJ. | |
// (accompanies https://gist.github.com/mikebridge/c75835cda361c5967de301995894bf30) | |
// | |
// Create: Settings -> Editor => Live Templates -> Add. | |
// - give it an abbreviation (e.g. "reduxtest") and a Description, and | |
// - Make it available in JavaScript "JSX HTML", JavaScript "Statement" and TypeScript | |
// | |
// Usage: create a file, e.g. "myTemplate.test.tsx", then type "Ctrl-J", and the abbreviation, e.g. "reduxtest". | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// A TypeScript template for generating a Redux Component in IntelliJ. | |
// | |
// Create: Settings -> Editor => Live Templates -> Add. | |
// - give it an abbreviation (e.g. "redux") and a Description, and | |
// - set FILENAME_PASCAL to capitalize(fileNameWithoutExtension()) in "Edit Variables" | |
// - Make it available in JavaScript "JSX HTML", JavaScript "Statement" and TypeScript | |
// | |
// Usage: create a file, e.g. "myTemplate.tsx", then type "Ctrl-J", and the abbreviation, e.g. "redux". | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import {shallow, mount} from "enzyme"; | |
import withQueryString from "./withQueryString"; | |
import {IQueryStringProps} from "./withQueryString"; | |
import {MemoryRouter} from "react-router"; | |
interface ITestComponentOwnProps {} | |
class TestComponent extends React.Component<IQueryStringProps & ITestComponentOwnProps, {}> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
type HOCWrapped<PWrapped, PHoc> = React.ComponentClass<PWrapped & PHoc> | React.SFC<PWrapped & PHoc>; | |
const queryString = require("query-string"); | |
import {RouteComponentProps, withRouter} from "react-router"; | |
export interface IQueryStringProps { | |
params: any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"jest": { | |
"transform": { | |
"^.+\\.css$": "react-scripts-ts/config/jest/cssTransform.js", | |
".(ts|tsx)": "react-scripts-ts/config/jest/typescriptTransform.js", | |
"^(?!.*\\.(css|json)$)": "react-scripts-ts/config/jest/fileTransform.js" | |
}, | |
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", | |
"moduleFileExtensions": [ | |
"ts", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import {IWithPersonalizationProps, withPersonalization} from "./withPersonalization2"; | |
import {IWithNavigationProps, withNavigation} from "./withNavigation"; | |
// This empty declaration is required | |
interface IWelcomeOwnProps {} | |
type IWelcomeProps = IWelcomeOwnProps & IWithNavigationProps & IWithPersonalizationProps; | |
class Welcome extends React.Component<IWelcomeProps, {}> { |