Skip to content

Instantly share code, notes, and snippets.

@jvorcak
jvorcak / keysetter.js
Created August 27, 2018 14:12
Key Setter
/*
This function can be used in `compose` to decide on a key for a given component
@example:
export default compose(
connect(state => ({
a: state.a,
b: state.b,
})),
KeySetter(props => `${props.a}-${props.b}`), // remounts a component if one of `a` or `b` changes.
@jvorcak
jvorcak / gist:499b99aa8fa5cd9bce774f3b05a1635b
Created May 10, 2018 17:37
Extract hash from SHA-1 cert
echo 83:F4...CD:46 | xxd -r -p | openssl base64
@jvorcak
jvorcak / humanize-duration.js
Last active July 10, 2019 14:37
Humanize duration wrapper
import React from 'react'
import humanizeDuration from "humanize-duration"
const shortEnglishHumanizer = humanizeDuration.humanizer({
language: 'shortEn',
spacer: '',
delimiter: ' ',
languages: {
shortEn: {
y: function() { return 'y' },
@jvorcak
jvorcak / tig.md
Last active October 11, 2019 17:24
tig - Text-mode interface for git

tig - Text-mode interface for git

This is a proposal for #ReactiveConf 2017 open call for Lightning talks.


Do you think that using git command line tool is the most efficient way of interacting with your repository? In this lightning talk, I will introduce tig - the ncurses front-end for git, which will make your interaction with git much more efficient.

tig combines the advantages of the command line and GUI tools like qgit. With a couple of keystrokes, you are

@jvorcak
jvorcak / gist:bedc836aed606a770223eaf7cbc84316
Created February 6, 2017 19:15
Padding top - React native router flux
<Scene icon={TabIcon} sceneStyle={{paddingTop: Navigator.NavigationBar.Styles.General.TotalNavHeight}} />
@jvorcak
jvorcak / gist:20e6dd968dc48659118f48be453de625
Created January 14, 2017 01:08 — forked from marty-wang/gist:5a71e9d0a6a2c6d6263c
Compile and deploy React Native Android app of Release version to device.
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
==================
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
@jvorcak
jvorcak / Enhance.js
Created October 20, 2016 14:19 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
npm rebuild node-sass
brew services stop rethinkdb