Skip to content

Instantly share code, notes, and snippets.

View nythrox's full-sized avatar
🌊

Jason Butler nythrox

🌊
View GitHub Profile
@cgsdev0
cgsdev0 / house_builder.sh
Created February 3, 2024 16:07
house builder pattern in bash
#!/usr/bin/env bash
function house_builder() {
# floors,rooms,has_garage
echo "0,0,0"
}
function set_field() {
local f r g
IFS=, read f r g
@tjjfvi
tjjfvi / ts-types-lambda-calc.ts
Last active February 17, 2024 21:03
Lambda Calculus in TypeScript Types: https://tsplay.dev/wE5nZw
type _I = Reduce<[S, K, K]>
// ^?
type One = I
type Zero = Reduce<[K, I]>
// ^?
type Add = { a: { b: { i: { z: ["a", "i", ["b", "i", "z"]] } } } }
type Mul = { a: { b: { i: ["a", ["b", "i"]] } } }
type Two = [Add, One, One]
type Three = [Add, Two, One]
type Six = [Add, Three, Two]
@mattyellen
mattyellen / UnityAsyncOperationAwaiter.cs
Created July 26, 2020 19:36
Allows the use of async/await (instead of yield) with any Unity AsyncOperation
public static class ExtensionMethods
{
public static TaskAwaiter GetAwaiter(this AsyncOperation asyncOp)
{
var tcs = new TaskCompletionSource<object>();
asyncOp.completed += obj => { tcs.SetResult(null); };
return ((Task)tcs.Task).GetAwaiter();
}
}
@Kavignon
Kavignon / improving-as-a-software-developer.md
Last active October 27, 2023 17:49
Always hungry for more. This is a list of resources I've used or that I plan to use as a way to improve my knowledge and technical skills as a software developer.

Some of the books I'll be recommending are based on .NET. Do not be discouraged. We shouldn't strive to stick to a specific technology stack. Your ambitions and goals will evolve over time and that might lead you a completely new space. Moreover, there are lessons to be learned from an environment that's different from what you're used to.

Software Development

@kognise
kognise / readme.md
Last active March 12, 2022 23:19
GitHub and Obsidian
  • Create a repository and set it to private if you want
  • In your vault, run these commands substituting the values
    git init
    git add .
    git commit -m "Initial commit"
    git remote add origin git@github.com:<USERNAME>/<REPO_NAME>.git
    git push -u origin master
    
  • Now...
@acutmore
acutmore / README.md
Last active January 21, 2024 20:30
Emulating a 4-Bit Virtual Machine in (TypeScript\JavaScript) (just Types no Script)

A compile-time 4-Bit Virtual Machine implemented in TypeScript's type system. Capable of running a sample 'FizzBuzz' program.

Syntax emits zero JavaScript.

type RESULT = VM<
  [
    ["push", N_1],         // 1
    ["push", False],       // 2
 ["peek", _], // 3
@WebReflection
WebReflection / inline-js-modules.js
Last active August 9, 2023 10:36
PoC: How to inline ES modules
const env = {
m1: `import {func} from './m2.mjs'; console.log(func());`,
m2: `export function func() { return 'abc'; }`
};
const inlineModule = (env, text) => `data:text/javascript;base64,${
btoa(inlineModules(env, text))
}`;
const inlineModules = (env, text) => text.replace(
@simlrh
simlrh / composable.ts
Last active April 17, 2022 05:39
Typescript compose and pipe "infix operators"
interface Composable<B,C> {
(b: B): C;
I: <D>(f: (c: C) => D) => Composable<B,D>;
o: <A>(f: (a: A) => B) => Composable<A,C>;
}
/*
* Non-type safe internal function - type safety of result is guaranteed by
* allowing creation only through `I` and `o` functions and methods
*/
@patroza
patroza / controller-presenter-interactor.cs
Last active September 18, 2020 03:00
Literal Controller/Presenter/Interactor implementation sample (naive), I prefer MediatR instead for most cases :) from http://www.plainionist.net/Implementing-Clean-Architecture-Controller-Presenter/
// "controller"
(ctx, next) => {
let presenter = new Presenter(ctx)
let interactor = new Interactor(presenter)
interactor.handle(getRequestFrom(ctx))
}
class Presenter {
constructor(ctx) { this.ctx = ctx }
present(response) {
@gusbicalho
gusbicalho / start-here-you-are-not-so-smart.md
Last active November 11, 2022 14:49
A roadmap of interesting books

START HERE: You are not so smart

I recomend reading at least two of the above.

If you feel like you know enough about how your mind is fucked-up miscalibrated, you can move on to the lists below. Each one has a few sublists. The order of the sublists does not matter. For each sublist, the first link is the one I see as a good starting point, but the order does not matter too much, either.