Skip to content

Instantly share code, notes, and snippets.

View VitorLuizC's full-sized avatar

Vitor L Cavalcanti VitorLuizC

View GitHub Profile
@johnchandlerburnham
johnchandlerburnham / ATaxonomyOfSelfTypes.md
Last active August 15, 2024 12:26
A Taxonomy of Self Types

A Taxonomy of Self-Types

Part I: Introduction to Self-Types

Datatypes in the Formality programming language are built out of an unusual structure: the self-type. Roughly speaking, a self-type is a type that can depend or be a proposition on it's own value. For instance, the consider the 2 constructor datatype Bool:

@FreyaHolmer
FreyaHolmer / FlyCamera.cs
Last active April 2, 2025 18:53
A camera controller for easily flying around a scene in Unity smoothly. WASD for lateral movement, Space & Ctrl for vertical movement, Shift to move faster. Add this script to an existing camera, or an empty game object, hit play, and you're ready to go~
using UnityEngine;
[RequireComponent( typeof(Camera) )]
public class FlyCamera : MonoBehaviour {
public float acceleration = 50; // how fast you accelerate
public float accSprintMultiplier = 4; // how much faster you go when "sprinting"
public float lookSensitivity = 1; // mouse look sensitivity
public float dampingCoefficient = 5; // how quickly you break to a halt after you stop your input
public bool focusOnEnable = true; // whether or not to focus and lock cursor immediately on enable
@acutmore
acutmore / README.md
Last active February 27, 2025 19:55
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
@sibelius
sibelius / FormUseFormik.tsx
Last active March 10, 2025 03:04
Example showing how to useFormik and FormikProvider
type Props = {
};
const FormUseFormik = (props: Props) => {
const { enqueueSnackbar } = useSnackbar();
const onSubmit = (values) => {
enqueueSnackbar(`submit: ${JSON.stringify(values)}`, {
preventDuplicate: true,
persist: false,
});
@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
*/
import { mapObjIndexed } from 'ramda'
type PropMorphism
<TKeyValue, TContext extends object, TKeyName, TResult> =
(value: TKeyValue, context: TContext, keyname: TKeyName) =>
TResult
/**
* Use HasExactlySameKeys if you want to assure to procced
function createStore({ state, mutations }) {
return {
state: Vue.observable(state),
commit(key, ...args) {
mutations[key](state, ...args)
}
}
}
const store = createStore({
state: { count: 0 },
@sbrl
sbrl / Ansi.mjs
Last active April 18, 2021 03:20
[Ansi.mjs] VT100 ANSI escape sequence generator in JS. Ported from the C# version.
"use strict";
/**
* Generates various VT100 ANSI escape sequences.
* Ported from C#.
* @licence MPL-2.0 <https://www.mozilla.org/en-US/MPL/2.0/>
* @source https://gist.github.com/a4edd3204a03f4eedb79785751efb0f3#file-ansi-cs
* @author Starbeamrainbowlabs
* GitHub: @sbrl | Twitter: @SBRLabs | Reddit: u/Starbeamrainbowlabs
***** Changelog *****
@matvaleriano
matvaleriano / reactSummary.md
Last active June 5, 2020 23:03
React summary only examples #summary #react #examples

React Resume

Props

Props são atributos que podem ser passados para componentes (não mude eles dentro do component que vc está usando)

Pros are attributes that can be passed to components (don't change them into the component which is using them)

States

A melhor forma de manipular as props que foram passadas e outros atributos do seu component