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 / 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
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 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()
}
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)
}
// 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))
@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();
}
}
// Place your key bindings in this file to overwrite the defaults
[{
"key": "shift+ctrl+p",
"command": "cursorUpSelect",
"when": "editorTextFocus"
},
{
"key": "shift+ctrl+f",
"command": "cursorRightSelect",
"when": "editorTextFocus"
@elfenlaid
elfenlaid / test.json
Last active February 8, 2019 20:28
vscode elixir test setup
{
"version": "2.0.0",
"tasks": [
{
"label": "mix test all",
"type": "shell",
"command": "mix",
"args": ["test", "--color", "--trace"],
"options": {
"cwd": "${workspaceRoot}",
git config --global alias.trim '!f() { git branch | grep -v "\*" | xargs -n 1 git branch -D; }; f'