Skip to content

Instantly share code, notes, and snippets.

View full-sized 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
@olivopablo
olivopablo / [...nextauth].js
Last active January 8, 2023 20:15
Strapi Next-Auth credentials provider
View [...nextauth].js
import NextAuth from "next-auth";
import Providers from "next-auth/providers";
const options = {
providers: [
Providers.Credentials({
// The name to display on the sign in form (e.g. 'Sign in with...')
name: 'Credentials',
// The credentials is used to generate a suitable form on the sign in page.
// You can specify whatever fields you are expecting to be submitted.
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 April 19, 2019 00:30
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 December 10, 2018 22:06
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 October 8, 2018 10:03
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 January 28, 2018 15:24
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 | |----------------|--

@timdorr
timdorr / MainApplication.java
Created February 11, 2017 14:36
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 October 4, 2016 16:10
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
@ivanoats
ivanoats / fetch-from-contentful.js
Created June 17, 2016 18:45
fetch-from-contentful.js
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 })