Docker & Stuff
# to filter by image name
FILTER=ancestor=$1
import { applyLiveQueryJSONPatch } from "@n1ru4l/graphql-live-query-patch-json-patch"; | |
import { | |
applyAsyncIterableIteratorToSink, | |
makeAsyncIterableIteratorFromSink, | |
} from "@n1ru4l/push-pull-async-iterable-iterator"; | |
import { createClient as createWSClient } from "graphql-ws"; | |
import { | |
cacheExchange, | |
createClient, | |
dedupExchange, |
{ | |
"@typescript-eslint/eslint-plugin": "^2.21.0", | |
"@typescript-eslint/parser": "^2.21.0", | |
"babel-eslint": "^10.1.0", | |
"eslint": "^6.8.0", | |
"eslint-config-prettier": "^6.10.0", | |
"eslint-config-react-app": "^5.2.0", | |
"eslint-plugin-flowtype": "^4.6.0", | |
"eslint-plugin-import": "^2.20.1", | |
"eslint-plugin-jsx-a11y": "^6.2.3", |
// main process then | |
const { app } = require('electron') | |
const fs = require('fs') | |
const directory = app.getPath('home') // /home folder on OS X | |
const cacheDirectory = `${directory}/twitch-bot-cache` // /home/twitch-bot-cache/ | |
const cacheDataFile = `${cacheDirectory}/data.json` // /home/twitch-bot-cache/data.json | |
// "cached now" object | |
let caches = {} |
import React, { PureComponent } from 'react' | |
export default class extends PureComponent { | |
state = { | |
killCount: 0, | |
ytLink: '' | |
} | |
handleChange = (event) => { | |
this.setState({ |
To switch files/extensions/debugger... press CMD+Shift+[E|X|D|...]
https://marketplace.visualstudio.com/items?itemName=be5invis.vscode-custom-css
class App extends Component { | |
// return false = COMPONENT_SHOULD_NOT_UPDATE! | |
// return true = COMPONENT_SHOULD_UPDATE! | |
shouldComponentUpdate(nextProps, nextState) { | |
// PureComponent do this for you, not for everything tho | |
return this.props.value != nextProps.value; | |
} | |
render() { | |
return ( |
import * as React from 'react' | |
class Button extends React.PureComponent { | |
render() { | |
return ( | |
<button onClick={this.props.onClick}>{this.props.text}</button> | |
} | |
} | |
} |
function download(filename, text) { | |
// create link element | |
const element = document.createElement('a') | |
// set link href to our text | |
element.setAttribute('href', `data:text/plain;charset=utf-8,${encodeURIComponent(text)}`) | |
// set attribute download | |
element.setAttribute('download', filename) | |
import * as React from 'react' | |
import { render } from 'react-dom' | |
import { PieChart, Pie, Cell } from 'recharts' | |
const data = [ | |
{ | |
name: 'Low thing', | |
value: 3, | |
color: '#d0d0d0', | |
}, |