Skip to content

Instantly share code, notes, and snippets.

View RafalFilipek's full-sized avatar
😱

Rafau RafalFilipek

😱
View GitHub Profile
pure(
compose(
lifecycle({
componentWillMount: () => {
console.log(this, this.state, this.props); // function _class, undefined, undefined
},
componentDidMount: () => {
console.log(this, this.state, this.props); // function _class, undefined, undefined
},
})
interface Window {
Promise: PromiseConstructor;
}
declare var require: {
(path: string): any;
<T>(path: string): T;
(paths: string[], callback: (...modules: any[]) => void): void;
ensure: (paths: string[], callback: (require: <T>(path: string) => T) => void) => void;
};
@RafalFilipek
RafalFilipek / lorem.gql
Created October 24, 2016 11:16
Lorem Ipsum GraphQL
type Letter {
value: String
code: Int
}
type Word {
value: String,
letters: [Letter],
}
import React from 'react';
import { render } from 'react-dom';
import styled from 'styled-components';
const fontSizes = {
small: 10,
medium: 15,
big: 20,
};
<div>
<p>
My twitter account: <a href="https://twitter.com/rafalfilipek">rafal</a>
</p>
</div>
import { css } from 'emotion';
import styled from 'react-emotion';
const box = props => css`
composes:
${display(props)}
${flex(props)}
${direction(props)}
${alignItems(props)}
${alignSelf(props)}

In this example I have two base classes foo and bar.

const foo = css`
  color: red;
`;

const bar = css`
color: blue;
`;
alert(x)
@RafalFilipek
RafalFilipek / machine.js
Created November 21, 2019 10:27
Generated by XState Viz: https://xstate.js.org/viz
const suflerMachine = Machine({
initial: "types",
states: {
types: {
on: {
SELECT_TYPE: {
target: "processes",
actions: [
assign({
typeId: (_context, event) => event.id
@RafalFilipek
RafalFilipek / m.tsx
Created November 24, 2019 22:18
1 hour with xstate
/**
* xstate - 4.7.0-rc.6
* typescript - 3.7.2
*/
import React from "react";
import { createMachine, assign } from "xstate";
import { useMachine } from "@xstate/react";
interface Context {
name?: string;