A collection of code snippets that create servers in as few steps as possible.
// setup (61 bytes):
const http = require('http');
/** | |
* 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 => |
--[[ | |
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 |
/** | |
* @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) { |
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() { |
useSubscription
and useMutableSource
1 tearing and deopt behavior.
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.
N/A.
pcall(require,"socket") | |
local coroutine_scheduler = { | |
_NAME = "coroutine_scheduler.lua" | |
_VERSION = "1.0.0", | |
} | |
local Scheduler | |
do Scheduler = setmetatable({}, { | |
__call = function(class) |