Skip to content

Instantly share code, notes, and snippets.

View tail-call's full-sized avatar
🐚
Conch

Maria tail-call

🐚
Conch
View GitHub Profile
@tail-call
tail-call / UIImage+noiseAnimation.swift
Created March 14, 2024 04:10
UIImage noise animation generator
import UIKit
public extension UIImage {
static var noiseAnimation: UIImage = {
makeNoiseAnimation(
size: CGSize(width: 226, height: 168),
framesCount: 4,
magnitude: 0.5,
duration: 0.2
) ?? UIImage()
/// Используется для декодирования объектов, которые могут принимать один из двух типов
enum EitherDecodableEquatable<
Left: Decodable & Equatable,
Right: Decodable & Equatable
>: Decodable, Equatable {
case left(Left)
case right(Right)
init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
0 0 SUBSYSTEM ALGORITHMICAL ;
0 1 AUTHOR J SMITH MALE 43 YO ;
0 2 COMPANY JCN COMPUTING ;
0 3 DEPARTMENT BUSINESS COMPUTING !BLANK! ;
com 0 PUBLIC NOTE ^ ;
com 1 PUBLIC NOTE DEPARTMENT REQUIRES THREE WORDS ;
com 2 PUBLIC NOTE SO WE BLANK OUT THIRD WORD SEE ;
com 3 PUBLIC NOTE OP MANUAL VOL 8 ;
1 0 BEGIN EXTERNALIZABLE OPERATION FACTORIAL ;
1 1 DECLARE FACTORIAL ACCEPTS INTEGRAL PARAM NAMED ≈n≈ ;
--- Control flow functions
local function TypeCase(obj, fallthroughHandler)
return function (args)
for i = 1, #args, 2 do
local signature, action = args[i], args[i + 1]
local function doAction(o)
if type(action) == 'function' then
return action(o)
else
@tail-call
tail-call / run-length-encoding.lisp
Created June 14, 2023 15:12
Who are you running from?
(defun make-stack ()
(make-array 0 :fill-pointer 0 :initial-element nil))
(defun stack-push! (stack item)
(vector-push-extend item stack))
(defun run-length-encode (string)
(declare (type string string))
(let ((octets (string-to-octets string))
(stack (make-stack))
(defconstant ~bad-number~ (integer->bit-vector #xEDB88320)
"Used in CRC computation.")
;; From https://lispforum.com/viewtopic.php?p=6269#p6269
(defun integer->bit-vector (integer)
"Create a bit-vector from a positive integer."
(labels ((integer->bit-list (int &optional accum)
(cond ((> int 0)
(multiple-value-bind (i r) (truncate int 2)
(integer->bit-list i (push r accum))))
#lang racket/gui
(require srfi/26)
(define-syntax-rule (when condition . body)
(if condition
(begin . body)
(void)))
(define auto-clicker-prices
(require math/flonum)
(define (sorted-lists->stream list-1 list-2)
(cond ((empty? list-1) list-2)
((empty? list-2) list-1)
((< (car list-1)
(car list-2))
(stream-cons (car list-1)
(sorted-lists->stream (cdr list-1) list-2)))
(else
function* iota(n: number) {
for (let i = 0; i < n; i++) yield i;
return 8;
}
function* map<T, U>(generator: Generator<T>, mapper: (value: T) => U) {
for (const value of generator) {
yield mapper(value);
}
}
interface X {
x: any;
}
interface Y {
y: any;
}
interface Z {
z: any;