Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Freelance React / React Native Expert, Cross-platform fanboy (native, web...)

Max Thirouin MoOx

:shipit:
Freelance React / React Native Expert, Cross-platform fanboy (native, web...)
View GitHub Profile
View redux_types.js
import type { GlobalState } from 'redux/modules';
export type ExtractReturn<Fn> = $Call<<T>((...Iterable<any>) => T) => T, Fn>;
// ...
export type BaseAction = $ReadOnly<{ type: string, error?: boolean }>;
// ...
@fhammerschmidt
fhammerschmidt / ConvertStyles.re
Created Apr 19, 2019
Draft bs-react-native (legacy) to bs-react-native-next converter
View ConvertStyles.re
open Belt;
let teststring = {|
"container":
style([
flex(1.0),
backgroundColor(Colors.darkBackground),
justifyContent(SpaceBetween),
alignItems(Center),
overflow(Hidden),
@jasonbahl
jasonbahl / like-posts.php
Created Dec 10, 2018
Adding a "likePost" mutation for WPGraphQL
View like-posts.php
add_action( 'graphql_register_types', function() {
register_graphql_field( 'Post', 'likeCount', [
'type' => 'Int',
'description' => __( 'The number of likes for the post', 'your-textdomain' ),
'resolve' => function( $post ) {
$likes = get_post_meta( $post->ID, 'likes', true );
return isset( $likes ) ? (int) $likes : 0;
}
] );
@mlms13
mlms13 / gist:1e08ba6e9136b7d74a2cc57b5ce1bf10
Last active Oct 8, 2018
Use the Github API with RationalJS/Future and Belt.Result
View gist:1e08ba6e9136b7d74a2cc57b5ce1bf10
type error('err) =
| NetworkError
| ExpectedJson
| ParseError('err);
/**
* Map one kind of Belt.Result.Error into another kind of Belt.Result.Error
* e.g. (('err => 'otherError), Belt.Result.t('a, 'err)) => Belt.Result.t('a, 'otherError)
*/
let mapErr = (fn, r) => switch r {
@MoOx
MoOx / index.md
Last active Jan 28, 2018
MacBook Pro Thunderbold 3 / USB-C Dock station list
View index.md

| Name | Henge Docks - Horizontal Docking Station | Henge Docks - Tethered Dock | TS3 Lite CalDigit | TS3 CalDigit | Thunderbolt 3 Express Dock HD | Plugable TB3 | Elgato TB 3 Dock | OWC Thunderbolt 3 Dock | |----------------|--

View 0-bridging-react-native-cheatsheet.md
@timdorr
timdorr / MainApplication.java
Created Feb 11, 2017
Tesla App is now React Native!
View MainApplication.java
package com.teslamotors.TeslaApp;
import android.app.Application;
import com.BaiduMaps.BaiduPackage;
import com.airbnb.android.react.maps.MapsPackage;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.i18n.reactnativei18n.ReactNativeI18n;
@brennanMKE
brennanMKE / README.md
Created Oct 4, 2016
React Native on macOS Sierra
View README.md

React Native Trouble

Updating to macOS Sierra is causing trouble with React Native due to some of the Node.js and system utilities it uses. Specifically the watch utility fails due to a limit on the number of files which can be opened at a time.

The following command shows the current limit.

launchctl limit maxfiles
View fetch-from-contentful.js
#!/usr/bin/env babel-node
require('dotenv').config()
import contentful from 'contentful'
import fs from 'fs-extra-promise'
// Contentful Config
const apiToken = process.env.CONTENTFUL_DELIVERY_API_TOKEN
const spaceId = process.env.CONTENTFUL_SPACE_ID
const client = contentful.createClient({ accessToken: apiToken, space: spaceId })
@mpj
mpj / README.md
Last active Dec 12, 2020
REALLY quick and dirty static file dev server
View README.md

Usage

node dirtyserve.js

The point your browser to

http://localhost:3000/myfile.xxx

and the server will try to serve that file from the local server.