Skip to content

Instantly share code, notes, and snippets.

View mlnchk's full-sized avatar

Dan mlnchk

  • @besedachat
View GitHub Profile
@catalinmiron
catalinmiron / README.md
Created April 16, 2024 20:36
Expo app.json Apple Privacy Manifest

About

The privacy details that you may need to add for Apple Privacy Manifest.

This config plugin it's already available from expo >=50.0.17 (Part of this PR by aleqsio)

Tip

Read more about Privacy Manifest File from Apple docs

@stephancasas
stephancasas / sonoma-text-insertion-point-downgrade.jxa.js
Created October 7, 2023 02:58
Disable Sonoma Text Insertion Point ("Cursor" / "Caret")
#!/usr/bin/env osascript -l JavaScript
const App = Application.currentApplication();
App.includeStandardAdditions = true;
const kCFPrefsFeatureFlagsDir = '/Library/Preferences/FeatureFlags/Domain';
const kCFPrefsFeatureEnabledKey = 'Enabled';
const kUIKitDomainPrefsTemporaryPath = '/tmp/UIKit.plist';
const kUIKitRedesignedTextCursorKey = 'redesigned_text_cursor';
@gragland
gragland / use-optimistic-mutation-example.ts
Last active May 5, 2024 18:07
useOptimisticMutation for React Query. Optimistically update data in multiple locations with rollback on error.
import axios from 'axios'
import { useOptimisticMutation } from "./useOptimisticMutation.ts"
type Response = boolean
type Error = unknown
type MutationVariables = {itemId: string}
type Items = {id: string; name: string}[]
type Likes = {itemId: string}[]
type History = {type: string}[]
@sindresorhus
sindresorhus / esm-package.md
Last active May 30, 2024 04:33
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
{
"editor.formatOnSave": true,
// Enable per-language
"[javascript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
@aerobounce
aerobounce / macOS System Preference Pane Links.md
Last active April 19, 2024 14:26
macOS System Preference Pane Links
@samselikoff
samselikoff / cloudSettings
Last active January 10, 2024 21:52
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-05-01T19:06:41.818Z","extensionVersion":"v3.4.3"}
@jamesmacfie
jamesmacfie / README.md
Created October 22, 2019 02:53
iTerm 2 - script to change theme depending on Mac OS dark mode

How to use

In iTerm2, in the menu bar go to Scripts > Manage > New Python Script

Select Basic. Select Long-Running Daemon

Give the script a decent name (I chose auto_dark_mode.py)

Save and open the script in your editor of choice.

@manzoorwanijk
manzoorwanijk / yup-with-final-form.js
Last active May 29, 2024 01:53
How to properly use yup validation schema with (React) Final Form?
import * as yup from 'yup';
import { setIn } from 'final-form';
const validationSchema = yup.object({
email: yup.string().email(),
shipping: yup.object({
name: yup.string(),
phone: yup.object({
code: yup.string().matches(/^\+\d+$/i),
number: yup.number().max(10),
@iSanjayAchar
iSanjayAchar / recorder.js
Created October 23, 2018 06:21
Record Audio using JavaScript and Output in Base64
let recorder = null;
const onsuccess = (stream) => {
recorder = new MediaRecorder(stream, {
type: 'audio/ogg; codecs=opus'
});
recorder.start(); // Starting the record
recorder.ondataavailable = (e) => {