Skip to content

Instantly share code, notes, and snippets.

fbartho / 1. Problem.swift
Last active April 5, 2024 22:38
Swift Structured Concurrency - Actors and Rescheduling
actor Scheduler {
var tasks: [@Sendable () async -> Void]
func schedule(task: @escaping @Sendable () async -> Void) {
func executeAll() async {
while let t = tasks.popLast() {
// Tasks may schedule more tasks when they execute
await t()
// How do I defer this loop until any pending schedule operations hit my actor?
fbartho / tipsi-stripe.d.ts
Created September 5, 2020 16:05
Typings for tipsi-stripe@8.0.0
* File: /src/types/tipsi-stripe/tipsi-stripe.d.ts
* Project: tr_client
* Created Date: 2019-07-18
* Initial Implementation:
* Also relevant:
declare module "tipsi-stripe" {
import { Component } from "react";
fbartho / API-Generator
Created August 2, 2019 17:50
RFC For a Props Type / Constants / JSDocs Generator for tipsi-stripe

API Generator

This is a little helper module that uses TypeScript to generate the following:

  • props-types checkers for JavaScript -- for import into the appropriate locations
  • jsdocs-style Documentation Comments -- for manual copying into the main API interface
  • String Enums for Android -- for use in extracting objects from the API Bridge
  • String Enums for iOS -- for use in extracting objects from the API Bridge
  • A TypeScript .d.ts file -- Future Feature / .gitignored for now
fbartho / hoc-generics-partial-application.tsx
Last active July 26, 2019 17:46 — forked from miloszpp/hoc.ts
Test that demonstrates the new Generic Propagation features available in TypeScript 3.4
import React from "react";
interface InjectedProps {
injected1: string;
interface PubProps<Foo> {
pubProp1: Foo;
declare function bind<T>(
component: React.ComponentType<T & InjectedProps>,
fbartho / openx_bash_for_ios
Last active October 30, 2018 18:19 — forked from johngraham262/openx_bash_for_ios
A simple bash script that will open a `.xcworkspace` if it exists in the current directory, otherwise a `.xcodeproj` if it exists, otherwise nothing. It will print the name of the file that is being opened. When using Cocoapods with iOS apps, a second file is created with the `MyProject.xcworkspace` name, alongside the `MyProject.xcproject` file…
# Add the following lines of code to your `~/.bash_profile`,
# and then run `source ~/.bash_profile` to be able to execute
# this from the command line.
# Originally from:
# Spaces-in-filenames from:
openx() {
find . -maxdepth 1 -name *.xcworkspace -print0 | while IFS= read -r -d '' file; do
let arr = [1, 2, 3, 4, 5]
func someAsyncAPI(_ entry: Int, completion: @escaping (Int) -> Void) {
let sleepTime = max(0,3-entry) .now() + 0.1 * Double(sleepTime)) {
completion(entry * -1);
fbartho /
Created April 8, 2018 19:17
noahhaasis/conwaysGameOfLife Feedback on Request

noahhaasis/conwaysGameOfLife Feedback


  • Most of my feedback is going to be superficial and possibly wrong!
  • I'm not an active expert in C.
  • I haven't used the SDL toolkit since college.
  • I didn't run this code, I simply looked at it!


fbartho / 0. Synology RAID Expansion-Resync
Last active July 17, 2024 22:08
Walkthrough of what I did to increase performance on my Synology NAS box during an expansion, and afterwards.

Performance on Synology RAIDs

(especially while expanding)

Warning: The exact commands may not match for your particular linux OS / Synology(NAS) device. I had to customize the commands after exploring my particular system's setup.

If you're new to linux, or this is a new piece of hardware / a new synology device, jump down to the section called "Inspecting a setup"


fbartho /
Created August 4, 2017 17:33
Example of a Swift file that breaks swiftformat --self remove
swiftformat --self remove tmp.swift
fbartho / StencilHello.swift
Created March 16, 2017 09:18
Stencil -- basic templates get no output?
// ???
import Stencil
let environment = Environment()
let context = ["name": "kyle"]
print(try environment.renderTemplate(string: "Hello {{ name }}", context: context))
Produces output: