Skip to content

Instantly share code, notes, and snippets.

View agurtovoy's full-sized avatar
💥
Be all you can be

Aleksey Gurtovoy agurtovoy

💥
Be all you can be
  • Iowa City, IA
View GitHub Profile
@cray0000
cray0000 / MockFinalizationRegistry.js
Last active January 8, 2025 00:34
FinalizationRegistry mock using WeakRef. For React Native 0.75 New Architecture
export const REGISTRY_SWEEP_INTERVAL = 10000
// This is a mock implementation of FinalizationRegistry which uses WeakRef to
// track the target objects. It's used in environments where FinalizationRegistry
// is not available but WeakRef is (e.g. React Native >=0.75 on New Architecture).
export class WeakRefBasedFinalizationRegistry {
counter = 0
registrations = new Map()
sweepTimeout
@insidegui
insidegui / PlatformViewRepresentable.swift
Created August 10, 2022 18:13
Protocol that automatically adds UIViewRepresentable or NSViewRepresentable conformance to implementers according to the current platform
import SwiftUI
#if os(iOS) || os(tvOS)
public typealias PlatformView = UIView
public typealias PlatformViewRepresentable = UIViewRepresentable
#elseif os(macOS)
public typealias PlatformView = NSView
public typealias PlatformViewRepresentable = NSViewRepresentable
#endif
@nunogoncalves
nunogoncalves / BetterDecodingError.swift
Last active January 26, 2024 08:37
Better Decoding Error Messages
import Foundation
enum BetterDecodingError: CustomStringConvertible {
case dataCorrupted(_ message: String)
case keyNotFound(_ message: String)
case typeMismatch(_ message: String)
case valueNotFound(_ message: String)
case any(_ error: Error)
@dabrahams
dabrahams / StaticArrayInsertRemove.swift
Last active September 7, 2022 06:20
Static Array With Functional Insert and Remove Operations
// The point of this prototype is to prove that we can generate efficient code
// for single-element insertion and deletion on a statically-sized array, with
// stable types for the end products i.e.,
//
// type(of: a.removing(at: i).inserting(x, at: j)) == type(of: a)
//
// and
//
// type(of: a.inserting(x, at: j).removing(at: i)) == type(of: a)
@ihor-lev
ihor-lev / sublime_fix_home_end_keys.md
Last active June 17, 2025 18:28
Fix Sublime Text Home and End key usage on Mac OSX

Sublime Text Home/End keys default functionality jumps to the beginning and end of the file.

Fix Home and End keys to move the cursor to the beginning and end of lines.

Preferences > Key Bindings - User

Adding the following to the array:

{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
@HerrBertling
HerrBertling / cssnext-preset-env.md
Last active January 23, 2022 17:35
CSSNext to postcss-preset-env

My team found it rather hard to determine which stage to use – or whether it would be easier to stay with a certain stage and enable some features specifically.

So I ended up with a table of postcss-cssnext features, their postcss-preset-env counterparts (where I knew the option name) and the stage for each feature.

Here you go:

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at [email protected] or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

@martinbuberl
martinbuberl / git-import-repository.md
Last active May 28, 2025 21:05
Import an Existing Git Repository into Another

Import an Existing Git Repository into Another

Before: Folder Structure (Two Separate Repositories)

XXX
 |- .git
 |- (project files)
YYY
 |- .git
@nicholasknight
nicholasknight / adv2notes.md
Last active March 25, 2025 16:12
Kinesis Advantage 2 notes

(NOTE: Current and future versions of this and any other Advantage 2-related things I post will be at https://github.com/nicholasknight/adv2keyboard)

I received my Advantage 2 today. There's no full manual yet, even though keyboards are apparently arriving (hint, hint, Kinesis). The quick start guide leaves out the "power user mode", and there are some other quirks.

Update: A manual has been posted at http://www.kinesis-ergo.com/advantage2-resources/

It includes a dictionary for the key maps, but I know it leaves at least one possible key undocumented: it does not list f14, but I have successfully mapped my scrollock to f14 regardless.

It also mentions a firmware version (1.0.18) that doesn't seem to be available yet, with a new feature (status report playback speed).

@knowbody
knowbody / RNfontWeights.js
Created July 14, 2016 13:42
React Native Font Weight Cheatsheet iOS
{ fontWeight: '100' }, // Thin
{ fontWeight: '200' }, // Ultra Light
{ fontWeight: '300' }, // Light
{ fontWeight: '400' }, // Regular
{ fontWeight: '500' }, // Medium
{ fontWeight: '600' }, // Semibold
{ fontWeight: '700' }, // Bold
{ fontWeight: '800' }, // Heavy
{ fontWeight: '900' }, // Black