Skip to content

Instantly share code, notes, and snippets.

View EvanBacon's full-sized avatar
🥓
Markdown developer

Evan Bacon EvanBacon

🥓
Markdown developer
View GitHub Profile
@EvanBacon
EvanBacon / dismiss-completed-gh-notifications.js
Last active July 15, 2023 05:08
Select and dismiss GH notifications for merged and closed issues/PRs. https://twitter.com/Baconbrix/status/1679925775162548224?s=20
[...document.querySelectorAll('.notifications-list-item:has(.octicon-git-merge)'), ...document.querySelectorAll('.notifications-list-item:has(.octicon-skip)'), ...document.querySelectorAll('.notifications-list-item:has(.octicon-issue-closed)'), ...document.querySelectorAll('.notifications-list-item:has(.octicon-discussion-closed)'), ...document.querySelectorAll('.notifications-list-item:has(.octicon-git-pull-request-closed)')].forEach(el => el.querySelector('input').click()); setTimeout(() => document.querySelector('button[type="submit"][role="menuitem"][title="Done"].btn').click(), 200)
@EvanBacon
EvanBacon / expo-vscode-settings.json
Created February 14, 2023 18:33
Expo file nesting patterns. Ensure all related extensions are nested inside of the default file.
{
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.js": "${capture}.js.map, ${capture}.d.ts, ${capture}.d.ts.map",
"*.ts": "$(capture).test.ts, $(capture).test.tsx, $(capture).test.node.ts, $(capture).test.node.tsx, $(capture).test.native.ts, $(capture).test.native.tsx, $(capture).test.ios.ts, $(capture).test.ios.tsx, $(capture).test.web.ts, $(capture).test.web.tsx, $(capture).test.android.ts, $(capture).test.android.tsx, ${capture}.native.tsx, ${capture}.ios.tsx, ${capture}.android.tsx, ${capture}.web.tsx, ${capture}.native.ts, ${capture}.ios.ts, ${capture}.android.ts, ${capture}.web.ts, ${capture}.native.js, ${capture}.ios.js, ${capture}.android.js, ${capture}.web.js, ${capture}.native.jsx, ${capture}.ios.jsx, ${capture}.android.jsx, ${capture}.web.jsx",
"*.tsx": "$(capture).test.ts, $(capture).test.tsx, $(capture).test.node.ts, $(capture).test.node.tsx, $(capture).test.native.ts, $(capture).test.native.tsx, $(capture).test.ios.ts, $(capture).test.ios.tsx, $(captur
@EvanBacon
EvanBacon / withVideoImportSupport.js
Created October 13, 2022 19:26
An Expo Config Plugin that enables opening any video file type in your iOS app
// https://gist.github.com/EvanBacon/98858a341e2da209587455bbad465931
const includesEverything = {
CFBundleDocumentTypes: [
{
CFBundleTypeExtensions: ["*"],
CFBundleTypeName: "All files",
CFBundleTypeOSTypes: ["*"],
},
{
CFBundleTypeExtensions: ["mov"],
@EvanBacon
EvanBacon / metro-transformer.js
Created December 22, 2021 20:31
Using Realm with Expo Metro config "Exotic" bundling.
const { createExoticTransformer } = require("@expo/metro-config/transformer");
module.exports = createExoticTransformer({
// Add realm packages to the list of modules to transpile locally.
transpileModules: ["@realm/", "realm"],
});
@EvanBacon
EvanBacon / RootViewBackgroundColor.tsx
Created December 10, 2021 21:44
A stack based Expo component for setting the background color of the root view. Useful for changing the background color on certain screens or inside of native modals. Updates based on Appearance and AppState.
import * as SystemUI from 'expo-system-ui';
import * as React from 'react';
import { Appearance, AppState, AppStateStatus, ColorSchemeName, ColorValue } from 'react-native';
type ThemedColorValue = { light: ColorValue, dark: ColorValue };
type Props = { backgroundColor: ColorValue | ThemedColorValue }
const propsStack: Props[] = [];
@EvanBacon
EvanBacon / Info.plist.json
Last active May 15, 2023 08:53
[Expo Config Plugins] JSON version of CFBundleDocumentTypes, UTExportedTypeDeclarations, UTImportedTypeDeclarations from VLC app Info.plist -- good for importing different file formats into your app
{
"CFBundleDocumentTypes": [
{
"CFBundleTypeName": "Folder",
"CFBundleTypeRole": "Viewer",
"LSItemContentTypes": [
"public.folder"
]
},
{
@EvanBacon
EvanBacon / AndroidManifest.xml.diff
Last active November 29, 2021 16:30
Diff between SDK 42 & SDK 43 AppDelegate.m for user reference when updating dangerous Expo config plugins
diff --git a/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml b/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml
index 136676d7c5..764b402b52 100644
--- a/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml
+++ b/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml
@@ -8,25 +8,20 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- END OPTIONAL PERMISSIONS -->
- <application
- android:name=".MainApplication"
@EvanBacon
EvanBacon / transformAssetLocation.ts
Created August 20, 2021 20:09
Emulate "public path" functionality in React Native
import { Platform } from "react-native";
import getDevServer from "react-native/Libraries/Core/Devtools/getDevServer";
const devServerInfo = getDevServer();
/**
* Transform a local "public" path location to a URL that works in React Native.
*
* When the project is not hosted from a development server, use an offline path from an embedded asset.
*

h1

h2

h3

h4

h5
@EvanBacon
EvanBacon / 🧽.gif
Last active February 6, 2024 08:40
🥓
🧽.gif