Skip to content

Instantly share code, notes, and snippets.

Avatar
🐧
Slow Distillation ⚗️💭

elfenlaid elfenlaid

🐧
Slow Distillation ⚗️💭
View GitHub Profile
@elfenlaid
elfenlaid / issues.json
Last active Jun 10, 2021
Good First Issue Repositories
View issues.json
[
"easy-first-issue",
"starter-task",
"difficulty: easy",
"difficulty: moderate",
"difficulty: medium",
"difficulty: just a custom template away! easiest way to contribute!",
"difficulty: beginner",
"difficulty: intermediate",
"easy contribution",
@elfenlaid
elfenlaid / logs.swift
Created May 21, 2021
Custom Swift String Interpolation: Logs Privacy
View logs.swift
struct Message {
enum Privacy {
case `public`
case `private`
}
var value: String
}
extension Message: CustomStringConvertible {
View organization-variables.json
{
"owner": "SwiftPackageIndex",
"name": "SwiftPackageIndex-Server"
}
@elfenlaid
elfenlaid / README.md
Created Apr 16, 2021
Fish $PATH environment variable manager
View README.md

Fish $PATH environment variable manager

Install

Store file at ~/.config/fish/functions/path.fish path

Usage

$ path --help
View migrate_and_rollback_test.ex
defmodule EctoMigrationTest do
use ExUnit.Case
def rollback, do: Mix.Shell.IO.cmd("MIX_ENV=test mix ecto.rollback --all")
def migrate, do: Mix.Shell.IO.cmd("MIX_ENV=test mix ecto.migrate")
test "test rollback and migration" do
assert 0 == rollback()
assert 0 == migrate()
@elfenlaid
elfenlaid / CoreFoundation+PointerArguments.swift
Last active Jan 6, 2021
Calling Core Foundation functions with pointer arguments
View CoreFoundation+PointerArguments.swift
let pixelBufferPool: CVPixelBufferPool = // ...
unsafe_pointer: do {
let pixelBufferPointer = UnsafeMutablePointer<CVPixelBuffer?>.allocate(capacity: 1)
defer {
pixelBufferPointer.deinitialize(count: 1)
pixelBufferPointer.deallocate()
}
View linguistic_tagger.swift
import Foundation
let stmt: NSString = "Actionable emptiness"
let options: NSLinguisticTagger.Options = [.omitWhitespace, .omitPunctuation, .omitOther]
let stringRange = NSMakeRange(0, stmt.length)
let languageMap = ["Latn":["en"]]
stmt.enumerateLinguisticTags(in: stringRange, scheme: NSLinguisticTagScheme.lemma, options: options, orthography: nil) { tag, _, _, _ in
print(tag?.rawValue)
}
View boilerplate.swift
// Run any SwiftUI view as a Mac app.
import Cocoa
import SwiftUI
NSApplication.shared.run {
VStack {
Text("Hello, World")
.padding()
.background(Capsule().fill(Color.blue))