Skip to content

Instantly share code, notes, and snippets.

View darknoon's full-sized avatar

Andrew Pouliot darknoon

View GitHub Profile
@darknoon
darknoon / LocklessQueue.swift
Created November 11, 2020 21:30
LocklessQueue
//
// LocklessQueue.swift
// Famera
//
// Created by Andrew Pouliot on 11/11/20.
// Copyright © 2020 Famera. All rights reserved.
//
import Foundation
import CoreMedia
@darknoon
darknoon / XCAssets.ts
Created September 17, 2021 15:38
Is this the best way to generate a Zip file in Scripter?
const colors = figma.getLocalPaintStyles()
.map(c => {
const {name, paints} = c
const paint = paints[0]
if (isSolidPaint(paint)) {
const {opacity, color} = paint
const {r,g,b} = color
return {name, color: {red: r, green: g, blue: b, alpha: opacity} }
} else {
return undefined
@darknoon
darknoon / gist:65d06b5da6541672d1e774ea7297a641
Created January 5, 2022 17:38
Typescript error with react-spring and @react-three/fiber
Type 'Interpolation<[pan: number, tilt: number], [x: number, y: number, z: number, order?: string | undefined]>' is not assignable to type '[x: number, y: number, z: number, order?: string | undefined] | { x: number | FluidValue<number, any>; y: number | FluidValue<number, any>; z: number | FluidValue<number, any>; ... 14 more ...; _onChange: {}; } | [x: ...] | undefined'.
Type 'Interpolation<[pan: number, tilt: number], [x: number, y: number, z: number, order?: string | undefined]>' is not assignable to type '[x: number | FluidValue<number, any>, y: number | FluidValue<number, any>, z: number | FluidValue<number, any>, order?: string | FluidValue<string, any> | undefined]'.
/* eslint-disable @typescript-eslint/no-var-requires */
const { ReplaceSource } = require("webpack-sources")
/// This is a workaround for a bug in Figma plugins where they don't like the text "import("
class FigmaWorkaroundPlugin {
// based on BannerPlugin https://github.com/webpack/webpack/blob/05ebf5bba670152101d1cc0f42f165b9fd295164/lib/BannerPlugin.js
process(file) {
if (file.source().includes("import(")) {
const replace = new ReplaceSource(file, "fix import( in Figma plugins FigmaWorkaroundPlugin")
@darknoon
darknoon / jsx.min.gbnf
Created October 15, 2023 23:03
Minimal gbnf for jsx-ish content
## Trying to debug why this is slow
# root rule
root ::= jsxElement
# Main JSX Element
jsxElement ::=
"<" jsxElementName jsxAttributesOpt ">" jsxChildrenOpt "</" jsxElementName ">"
# JSX Self-Closing Element