Skip to content

Instantly share code, notes, and snippets.

View simonkberg's full-sized avatar
:shipit:

Simon Kjellberg simonkberg

:shipit:
View GitHub Profile
@simonkberg
simonkberg / RouterContainer.js
Last active June 21, 2016 10:29
`withRouter` as a Container Component
import React from 'react'
import { routerShape } from 'react-router'
import PresentationalComponent from './PresentationalComponent'
const RouterContainer = (props, context) =>
<PresentationalComponent router={context.router} />
RouterContainer.contextTypes = {
router: routerShape
}

Keybase proof

I hereby claim:

  • I am simonkberg on github.
  • I am simonkberg (https://keybase.io/simonkberg) on keybase.
  • I have a public key ASBwCZYmdNaMl6HEZd6yo-X8Oclvru7nz9TKVlzSqVCMugo

To claim this, I am signing this object:

@simonkberg
simonkberg / reactiflux-qa.md
Last active April 4, 2018 20:25
Q&A with Sophie Alpert (@sophiebits) on Reactiflux 2016-06-09

Q: Are there plans to support a web worker based rendered in React Core ? Angular2 has support for it in core - axemclion
A: right now we're not considering web workers in depth because it's difficult to carve off pieces that can be parallelized independently -- simply moving React to a separate thread while executing DOM operations on the main thread would free up the main thread but likely wouldn't improve responsiveness overall. so instead we're looking more at how we can do concurrent work on the main thread and cancel in-progress updates if new high-priority input arrives
we might experiment a little more with threads/workers on React Native, but that would likely be more along the lines of running parts of Relay in a separate thread since it's still hard to split up the component tree

Q: did you ever think you’d be learning about fibers and coroutines to implement a JavaScript UI library? 😃 - iamdustan
A: can't say I ever considered it, but I suppose I didn't expect that I wou

export const flatten = list => list.reduce(
(a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []
)
import flatten from './flatten'
export const replaceString = (input, pattern, replace) => {
const index = input.indexOf(pattern)
const isFunction = typeof replace === 'function'
if (index >= 0) {
const output = []
const lastIndex = index + pattern.length
[core]
editor = vim
[alias]
cm = commit
co = checkout
ac = !git add -A && git commit
st = status -sb
tags = tag -l
branches = branch -a
remotes = remote -v
syntax enable " enable syntax processing
set tabstop=4 " number of visual spaces per TAB
set softtabstop=4 " number of spaces in tab when editing
set expandtab " tabs are spaces
set number " show line numbers
set showcmd " show command in bottom bar
set wildmenu " visual autocomplete for command menu
set lazyredraw " redraw only when we need to.
set showmatch " highlight matching [{()}]
set incsearch " search as characters are entered
2015-02-17 16:48:09 ERROR Thread-28 :: Failed doing webui callback: Traceback (most recent call last):
2015-02-17 16:47:59 DEBUG Thread-28 :: Getting recommended shows from Trakt.tv
2015-02-17 16:47:33 DEBUG Thread-61 :: formatting pattern: Season %0S -> Season 02
2015-02-17 16:47:33 DEBUG Thread-61 :: Parsed Show.Name.003.HDTV.XviD-RLSGROUP into Show Name - S0E3 [ANIME VER: -1] [GROUP: RLSGROUP] [ABD: False] [ANIME: False] [whichReg: ['bare']]
2015-02-17 16:47:33 DEBUG Thread-61 :: Using ANIME regexs
2015-02-17 16:47:33 DEBUG Thread-61 :: formatting pattern: %S.N.S%0SE%0E.%Q.N-%RG -> Show.Name.S02E03.HD.TV-RLSGROUP
2015-02-17 16:47:33 DEBUG Thread-61 :: Episode has no release group, replacing it with 'RLSGROUP'
2015-02-17 16:47:33 DEBUG Thread-61 :: Parsed Show.Name.003.HDTV.XviD-RLSGROUP into Show Name - S0E3 [ANIME VER: -1] [GROUP: RLSGROUP] [ABD: False] [ANIME: False] [whichReg: ['bare']]
2015-02-17 16:47:33 DEBUG Thread-61 :: Using ANIME regexs
2015-02-17 16:47:33 DEBUG Thre
2015-02-17 16:49:15 ERROR Thread-37 :: Failed doing webui callback: Traceback (most recent call last):
KeyError: 13
fd_obj, handler_func = self._handlers[fd]
File "/media/sdk1/home/**********/.sickrage/tornado/ioloop.py", line 836, in start
Traceback (most recent call last):
2015-02-17 16:49:15 ERROR Exception in callback None
2015-02-17 16:48:23 INFO POSTPROCESSER :: Successfully processed
2015-02-17 16:48:23 DEBUG POSTPROCESSER :: You're trying to post process a video that's already been processed, skipping
2015-02-17 16:48:23 DEBUG POSTPROCESSER :: You're trying to post process a video that's already been processed, skipping
2015-02-17 16:48:23 DEBUG POSTPROCESSER :: You're trying to post process a video that's already been processed, skipping
2015-02-15 15:31:54 ERROR Thread-62 :: cannot concatenate 'str' and 'exceptions.TypeError' objects
KeyError: 14
fd_obj, handler_func = self._handlers[fd]
File "/media/sdk1/home/**********/.sickrage/tornado/ioloop.py", line 836, in start
Traceback (most recent call last):
2015-02-15 15:31:49 ERROR Exception in callback None
KeyError: 14
fd_obj, handler_func = self._handlers[fd]
File "/media/sdk1/home/**********/.sickrage/tornado/ioloop.py", line 836, in start
Traceback (most recent call last):