Skip to content

Instantly share code, notes, and snippets.

import React from 'react';
import { ApolloProvider } from 'react-apollo';
import { Provider } from 'react-redux';
import hoistNonReactStatic from 'hoist-non-react-statics';
export default apolloAndReduxProviderHOC = (WrappedComponent, store, client) => {
class Enhance extends React.Component {
render () {
return (
<Provider store={store}>
@manishkkatoch
manishkkatoch / MockCLLocationManager.swift
Created December 6, 2017 17:42
Mocking CLLocationManager
//
// MockCLLocationManager.swift
//
// Created by Manish Katoch on 11/28/17.
// Copyright © 2017 Manish Katoch. All rights reserved.
//
import Foundation
import CoreLocation
@nybblr
nybblr / example.js
Last active April 5, 2018 15:34
In-browser image resizing + processing
import processImage from 'process-image';
var file = /* File() object from drag-n-drop or file input */
var imageProcessOpts = {
maxWidth: 1200,
maxHeight: 1200,
quality: 0.6
};
@dispix
dispix / CHANGELOG.md
Last active July 22, 2024 10:27
OAUTH2 Authentication and token management with redux-saga

Revision 5

  • Fix error parsing

Revision 4

  • Add missing yield in the login function

Revision 3

@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active April 22, 2025 14:27
React Native Bridging Cheatsheet
// Usage
<Router>
<Provider store={store}>
<ListeningRouter>
<Main />
</ListeningRouter>
</Provider>
</Router>

Incrementing Android Version Documentation

Setup

Step One

Append the following version variable definitions to your app's build.gradle file, this can be anywhere but preferably at the top of the file above all "apply" declarations. You may set the values to your current build/version codes if this is not a new project.

def VERSION_BUILD=0
def VERSION_MAJOR=0
def VERSION_MINOR=0
@Rich-Harris
Rich-Harris / footgun.md
Last active March 9, 2025 06:13
Top-level `await` is a footgun

Edit — February 2019

This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:

  • TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
  • In the wild, we're seeing (async main(){...}()) as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems
  • Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.

I'll leave the rest of this document unedited, for archaeological

@knowbody
knowbody / RNfontWeights.js
Created July 14, 2016 13:42
React Native Font Weight Cheatsheet iOS
{ fontWeight: '100' }, // Thin
{ fontWeight: '200' }, // Ultra Light
{ fontWeight: '300' }, // Light
{ fontWeight: '400' }, // Regular
{ fontWeight: '500' }, // Medium
{ fontWeight: '600' }, // Semibold
{ fontWeight: '700' }, // Bold
{ fontWeight: '800' }, // Heavy
{ fontWeight: '900' }, // Black
@kennydee
kennydee / Fastfile
Last active September 23, 2018 18:49
Fastfile for staging environment with Appetize.io on React Native (iOs & Android), with statuses update on Github Enterprise
require 'httparty'
fastlane_version "1.95.0"
default_platform :ios
before_all do
# put here your token and iOs scheme app
ENV["GITHUB_TOKEN"] = "---"
ENV["APPETIZE_TOKEN"] = "---"
ENV["APP_IOS_SCHEME"] = "---"