Skip to content

Instantly share code, notes, and snippets.

View elfenlaid's full-sized avatar
🐧
Slow Distillation ⚗️💭

Egor Mihnevich elfenlaid

🐧
Slow Distillation ⚗️💭
View GitHub Profile
@elfenlaid
elfenlaid / mraid_tags.js
Created May 6, 2020 08:25
MRAID simple example
<script type="text/javascript">
function doReadyCheck() {
if (mraid.getState() == 'loading') {
//Wait until mraid library is ready and loaded so listen for ready event
mraid.addEventListener("ready", mraidIsReady);
}
else {
showMyAd();
}
}
// 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))
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)
}
@elfenlaid
elfenlaid / CoreFoundation+PointerArguments.swift
Last active January 6, 2021 06:55
Calling Core Foundation functions with pointer arguments
let pixelBufferPool: CVPixelBufferPool = // ...
unsafe_pointer: do {
let pixelBufferPointer = UnsafeMutablePointer<CVPixelBuffer?>.allocate(capacity: 1)
defer {
pixelBufferPointer.deinitialize(count: 1)
pixelBufferPointer.deallocate()
}
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 / README.md
Created April 16, 2021 10:47
Fish $PATH environment variable manager

Fish $PATH environment variable manager

Install

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

Usage

$ path --help
@elfenlaid
elfenlaid / README.md
Created April 28, 2021 06:38
Tailwind typography dark scheme
{
"owner": "SwiftPackageIndex",
"name": "SwiftPackageIndex-Server"
}
@elfenlaid
elfenlaid / logs.swift
Created May 21, 2021 07:46
Custom Swift String Interpolation: Logs Privacy
struct Message {
enum Privacy {
case `public`
case `private`
}
var value: String
}
extension Message: CustomStringConvertible {