Skip to content

Instantly share code, notes, and snippets.

View justingrant's full-sized avatar

Justin Grant justingrant

View GitHub Profile
@justingrant
justingrant / exportify-all.sh
Created April 20, 2023 09:01
Script for converting proposal-temporal's ecmascript.mjs to use exported functions
#!/bin/bash
# Convert ecmascript.mjs to use exported functions instead of a big exported object wih function properties
function exportify() {
cd polyfill/lib
# Exports from ES2022
sed -i '' 's/^const ES2022 =/export/' ecmascript.mjs
#!/bin/bash
# script to transform ecmascript.mjs to use exported functions
cd polyfill/lib
# Exports from ES2022
sed -i '' 's/^const ES2022 =/export/' ecmascript.mjs
# Beginning and ending of ES object
@justingrant
justingrant / babel-preset-react-app+10.0.0.patch
Created September 4, 2021 18:00
Patch (using patch-package) for getting why-did-you-render to work with create-react-app V4
diff --git a/node_modules/babel-preset-react-app/create.js b/node_modules/babel-preset-react-app/create.js
index 99a930b..c898a12 100644
--- a/node_modules/babel-preset-react-app/create.js
+++ b/node_modules/babel-preset-react-app/create.js
@@ -96,7 +96,11 @@ module.exports = function (api, opts, env) {
// Will use the native built-in instead of trying to polyfill
// behavior for any plugins that require one.
...(opts.runtime !== 'automatic' ? { useBuiltIns: true } : {}),
- runtime: opts.runtime || 'classic',
+ // runtime: opts.runtime || 'classic',
@justingrant
justingrant / gist:f86a84c44982db36794f8bb484d135f2
Created September 1, 2021 06:08
Temporal multi-type string parse proof-of-concept
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/*
type Temporal = typeof Temporal;
const types = [
'ZonedDateTime',
// Adapted from an old version of volune/source-map-loader#fixes fork
// This webpack plugin will test to make sure that sourcemaps match the
// underlying source code in node_modules
var fs = require('fs');
const findFirstDiffPos = (a, b) => {
if (typeof a !== 'string' || typeof b !== 'string') {
return 0;
@justingrant
justingrant / index.js
Created November 6, 2020 17:15
Temporal workshop sample
/*
** Copyright 2020 Bloomberg Finance L.P.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
@justingrant
justingrant / index.d.ts
Last active May 5, 2021 05:42
TypeScript types for tc39/proposal-temporal
export namespace Temporal {
export type ComparisonResult = -1 | 0 | 1;
export interface DisambiguationOptions {
disambiguation: 'constrain' | 'balance' | 'reject';
}
export interface ArithmeticOptions {
disambiguation: 'constrain' | 'reject';
}
{
"name": "h3",
"version": "0.1.0",
"private": true,
"dependencies": {
"@aws-amplify/analytics": "file:../../amplify-js/packages/aws-amplify-analytics-1.3.2.tgz",
"@aws-amplify/api": "file:../../amplify-js/packages/aws-amplify-api-1.2.2.tgz",
"@aws-amplify/auth": "file:../../amplify-js/packages/aws-amplify-auth-1.4.2.tgz",
"@aws-amplify/cache": "file:../../amplify-js/packages/aws-amplify-cache-1.1.2.tgz",
"@aws-amplify/core": "file:../../amplify-js/packages/aws-amplify-core-1.2.2.tgz",
{
"name": "h3",
"version": "0.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@aws-amplify/analytics": {
"version": "file:../../amplify-js/packages/aws-amplify-analytics-1.3.2.tgz",
"integrity": "sha512-cXMDA8Pm9ALp8wfhBd1BXjMUm5GW05/RZSTr3YDQWyc9gUP+Rx8KeT4ntez1rYBbMnG39dOGFkeESyCcc/mzAA==",
"requires": {
@justingrant
justingrant / FullCalendar.tsx
Created October 24, 2019 17:22
react wrapper for FullCalendar.io that calls gotoDate() when props.defaultDate is changed
// adapted from https://github.com/fullcalendar/fullcalendar-react/blob/b23f8cbc67b4b75429bc3192eb8301ab1259a21c/src/FullCalendar.tsx
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
import { Calendar, OptionsInput } from '@fullcalendar/core';
import deepEqual from 'fast-deep-equal';
// type-safe equivalent to Object.keys
function keysOf<T>(o: T) {
return Object.keys(o) as (keyof T)[];
}