Skip to content

Instantly share code, notes, and snippets.

View wyqydsyq's full-sized avatar
🌏
Breaking the Internet

wyqydsyq wyqydsyq

🌏
Breaking the Internet
  • Brisbane, Australia
View GitHub Profile
@wyqydsyq
wyqydsyq / README.md
Created February 20, 2020 01:12
React updateStatePair

updateStatePair

Ever got tired of repeating this pattern everywhere when you want to update just one key/value pair in your state? Noticed the key/values you set in setState aren't typechecked and wish you had type safety when doing this kind of thing?

setState(prevState => ({ ...prevState, [key]: value })
// `key` and `value` can be anything here, does not have to match the type of your State

updateStatePair to the rescue!

@wyqydsyq
wyqydsyq / config.fish
Created July 4, 2018 01:07
config.fish
set -x TERM xterm-256color
set -gx PATH ~/.local/bin/ $PATH
set -gx VISUAL code --wait
set -gx EDITOR $VISUAL
set -U fish_prompt_pwd_dir_length 0
@wyqydsyq
wyqydsyq / users.ts
Created July 30, 2017 23:48
Standalone Waterline Koa Handler
import * as R from 'ramda'
const update = (context, query = {}, data = {}) => new Promise((res, rej) => {
context._waterline
.collections
.users
.update(query, data)
.exec((error, result) => {
if (error) {
return rej(error)
@wyqydsyq
wyqydsyq / hyper.js
Created May 22, 2017 04:56
hyper.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 16,
// font family with optional fallbacks
@wyqydsyq
wyqydsyq / esnextbin.md
Last active May 2, 2017 05:23
esnextbin sketch
@wyqydsyq
wyqydsyq / tump.txt
Created March 23, 2017 13:15
dota2 steam dump
Running Steam on opensuse tumbleweed 20170213 64-bit
STEAM_RUNTIME is enabled automatically
Installing breakpad exception handler for appid(steam)/version(1490127986)
Installing breakpad exception handler for appid(steam)/version(1490127986)
Installing breakpad exception handler for appid(steam)/version(1490127986)
Installing breakpad exception handler for appid(steam)/version(1490127986)
Installing breakpad exception handler for appid(steam)/version(1490127986)
Installing breakpad exception handler for appid(steam)/version(1490127986)
Installing breakpad exception handler for appid(steam)/version(1490127986)
Installing breakpad exception handler for appid(steam)/version(1490127986)
@wyqydsyq
wyqydsyq / login.ts
Last active March 23, 2017 03:10
login.ts
import Auth0Lock from 'auth0-lock'
import { Observable } from 'rxjs'
import { push } from 'react-router-redux'
import { error as logError } from '../../util/logger'
import {
types as userTypes,
actions as userActions
} from '../actions/user'
@wyqydsyq
wyqydsyq / test.tsx
Created March 17, 2017 05:02
Enzyme + MUI
import * as React from 'react'
import * as enzyme from 'enzyme'
import * as sinon from 'sinon'
import * as dom from 'jsdom'
import getMuiTheme from 'material-ui/styles/getMuiTheme'
import MyDialog from './MyDialog'
global['document'] = dom.jsdom('<html></html>')
@wyqydsyq
wyqydsyq / .tmux.conf
Last active June 19, 2017 04:32
My Tmux Config
run-shell "powerline-daemon -q"
source "/usr/lib/python3.6/site-packages/powerline/bindings/tmux/powerline.conf"
set-option -ga terminal-overrides ",xterm-256color:Tc"
set-option -g renumber-windows on
set-option -g history-limit 9001
set -g base-index 1
set -g mouse on
import Cycle from '@cycle/xstream-run'
import { makeDOMDriver } from '@cycle/dom'
import { timeDriver } from '@cycle/time'
const { rerunner, restartable } = require('cycle-restart')
import Main from './main'
const getMain = () => require('./main').default
const getDrivers = () => ({