Skip to content

Instantly share code, notes, and snippets.

View dcalhoun's full-sized avatar

David Calhoun dcalhoun

View GitHub Profile
@devtanc
devtanc / App.js
Last active September 2, 2022 09:07
How to have `onXYZ` event hooks in a ReactNative Native UI Component in Swift
// This file is from an actual react app that would install the library outlined in the rest of these files
import React from 'react'
import { SafeAreaView, StyleSheet, View } from 'react-native'
import RichTextEditor from 'react-native-rich-text-editor'
const styles = StyleSheet.create({
body: {
flex: 1,
},
inputContainer: {
@chenglou
chenglou / code.re
Last active July 18, 2021 12:13
Recommended way to do HTTP requests in ReScript
// bindings can be isolated/upstreamed. I'm inlining it just for the example
type request;
type response;
[@bs.new] external makeXMLHttpRequest: unit => request = "XMLHttpRequest";
[@bs.send] external addEventListener: (request, string, unit => unit) => unit = "addEventListener";
[@bs.get] external response: request => response = "response";
[@bs.send] external open_: (request, string, string) => unit = "open";
[@bs.send] external send: request => unit = "send";
[@bs.send] external abort: request => unit = "abort";
// =========
@stokesman
stokesman / vite.config.js
Created October 24, 2023 18:56
Rudimentary Vite config that builds with WordPress dependency extraction
import { createHash } from 'crypto'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import {
defaultRequestToExternal,
defaultRequestToHandle
} from '@wordpress/dependency-extraction-webpack-plugin/lib/util.js'
import json2php from 'json2php'
import packageMeta from './package.json';