Skip to content

Instantly share code, notes, and snippets.

View lxsmnsyc's full-sized avatar
🤖
I'm not a robot

Alexis H. Munsayac lxsmnsyc

🤖
I'm not a robot
View GitHub Profile
@terakilobyte
terakilobyte / request.js
Created October 20, 2018 15:39
request
/**
* Parses the JSON returned by a network request
*
* @param {object} response A response from a network request
*
* @return {object} The parsed JSON, status from the response
*/
function parseJSON(response) {
return new Promise(resolve =>
response.json().then(json =>
@nyaocat
nyaocat / readonly.lua
Last active October 20, 2018 15:49
Lua Read Only Table (or Userdata) module http://nyaocat.hatenablog.jp/entry/2013/11/09/111856
--[[
lua readonly module
2013 (c) nyaocat
this program is licensed under NYSL( http://www.kmonos.net/nysl/ )
lua5.1 and lua5.2
]]
local newproxy = newproxy or require("newproxy") -- for Lua5.2
local type, getmetatable, pairs, assert, error = type, getmetatable, pairs, assert, error
@zz85
zz85 / GPUComputationRenderer.js
Last active January 20, 2020 14:37
Faster Pixel Sort
/**
* @author yomboprime https://github.com/yomboprime
*
* GPUComputationRenderer, based on SimulationRenderer by zz85
*
* The GPUComputationRenderer uses the concept of variables. These variables are RGBA float textures that hold 4 floats
* for each compute element (texel)
*
* Each variable has a fragment shader that defines the computation made to obtain the variable in question.
* You can use as many variables you need, and make dependencies so you can use textures of other variables in the shader
function commitAllWork(fiber) {
fiber.effects.forEach(f => {
commitWork(f);
});
fiber.stateNode._rootContainerFiber = fiber;
nextUnitOfWork = null;
pendingCommit = null;
}
function commitWork(fiber) {
@jonathantneal
jonathantneal / README.md
Last active June 28, 2020 13:43
Minimal Node Servers

Minimal Node Servers

A collection of code snippets that create servers in as few steps as possible.

Minimal HTTP Server

// setup (61 bytes):
const http = require('http');
@lelandrichardson
lelandrichardson / Recoil.kt
Created August 28, 2020 14:52
Recoil vs Compose
var text by mutableStateOf("")
val charCount: Int get() = text.length
val todoList = mutableStateListOf<Item>(emptyList())
val filteredTodoList get() = when (todoListFilter) {
Filter.Completed -> todoList.filter { it.isComplete }
Filter.Uncompleted -> todoList.filter { !it.isComplete }
Filter.All -> todoList
}
@Composable fun Example() {
@jaredpalmer
jaredpalmer / oauth-device-flow.md
Last active September 1, 2021 09:35
OAuth 2.0 Device Flow

OAuth Device Flow

This is flow used by apps on Apple TV / Roku. However, it is also useful for CLIs.

Here is my rundown. Please correct me in comments if something is wrong or if there is a better way to do this.


Device pings the server to begin activation process

@bvaughn
bvaughn / useSubscription-and-useMutableSource.md
Last active December 29, 2021 02:12
`useSubscription` and `useMutableSource` tearing and deopt behavior.

useSubscription and useMutableSource1 tearing and deopt behavior.

Mounting a new tree

The tree below represents a React application mounting. During mount, two components read from an external, mutable source. The first one (List) reads version 1 of that data and the second one (Item) reads version 2.

Deopt

useSubscription (legacy mode)

N/A.

@brendanzab
brendanzab / reactive_systems_bibliography.md
Last active October 10, 2022 06:36
A reading list that I'm collecting while building my Rust ES+CQRS framework: https://github.com/brendanzab/chronicle

Functional, Reactive, and Distributed Systems Bibliography

Books

@Deco
Deco / coroutine_scheduler.lua
Created February 13, 2012 16:38
Lua Coroutine Scheduler
pcall(require,"socket")
local coroutine_scheduler = {
_NAME = "coroutine_scheduler.lua"
_VERSION = "1.0.0",
}
local Scheduler
do Scheduler = setmetatable({}, {
__call = function(class)