Skip to content

Instantly share code, notes, and snippets.

View zushenyan's full-sized avatar
🤪
writing bugs~

Andrew Yan zushenyan

🤪
writing bugs~
View GitHub Profile
@zushenyan
zushenyan / tv-tt.html
Last active February 4, 2023 10:11
tv bug report
<!DOCTYPE HTML>
<html>
<head>
<title>TradingView Trading Terminal demo</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
<script type="text/javascript" src="charting_library/charting_library.standalone.js"></script>
<script type="text/javascript" src="datafeeds/udf/dist/bundle.js"></script>
<script type="text/javascript">
const tvKey = "tv-tp"
const DefaultResolutions = ['1S', '1', '3', '5', '15', '30', '60', '120', '240', '360', '480', '720', '1D', '3D', '1W', '1M']
@zushenyan
zushenyan / machine.js
Created December 5, 2020 10:27
Generated by XState Viz: https://xstate.js.org/viz
const machine = Machine({
initial: 'ready',
on: {
TYPE: {
target: 'startSearching',
actions: ['setKeyword'],
},
SEARCH: 'searching',
ERROR: 'error',
},
import { Machine, Interpreter, assign, spawn } from 'xstate'
import InputMachine, {
Context as InputContext,
Schema as InputSchema,
Events as InputEvents
} from './inputMachine'
import { submitForm, Response } from './api'
export type Context = {
email: Interpreter<InputContext, InputSchema, InputEvents> | undefined
// index.js
import React from "react";
import ReactDOM from "react-dom";
import Select from "react-select";
import "./styles.css";
const options = [
{ label: "aaa", value: 1 },
{ label: "bbb", value: 2 },
{ label: "ccc", value: 3 }
import React from 'react';
import { Field, reduxForm } from 'redux-form';
import AutoSuggest from 'react-autosuggest';
import styles from './styles.css';
const suggestions = [
{ label: 'Apple', value: 1 },
{ label: 'Aqua', value: 2 },
{ label: 'Banana', value: 3 },
{ label: 'Bean', value: 4 },
import 'react-select/dist/react-select.css';
import React from 'react';
import { Field, reduxForm } from 'redux-form';
import Select from 'react-select';
const transValue = (value) => ({ label: value, value });
const Input = ({ input, options = [], showDropdown = false }) => {
return <Select.Creatable
inputProps={input}
interface Field {
name: string;
path?: string;
}
interface Fields {
[name: string]: Section | Field;
}
interface Section extends Field {
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import {
SortableTreeWithoutDndContext as SortableTree,
dndWrapExternalSource,
insertNode
} from 'react-sortable-tree';
import HTML5Backend from 'react-dnd-html5-backend';
import { DropTarget, DragDropContext } from 'react-dnd';
import _ from "lodash";
import {fn as isGeneratorFn} from "is-generator";
const generatorMiddleware = store => next => action => {
let {dispatch} = store;
let generator = findGenerator(action);
if(isGeneratorFn(action)){
return runGenerator(dispatch, action, action);
}
else if(generator){