Skip to content

Instantly share code, notes, and snippets.

View jayphelps's full-sized avatar
💭
I may be slow to respond.

Jay Phelps jayphelps

💭
I may be slow to respond.
View GitHub Profile

Modern Script Loading

Loading modern code for modern browsers while still supporting older browsers should be possible via module/nomodule:

<script type="module" src="/modern.js"></script>
<script nomodule src="/legacy.js"></script>

... however this results in over-fetching of scripts in Edge and Safari.

@kentcdodds
kentcdodds / README.md
Last active March 10, 2021 00:21
slice-js so far...

slice-js

So far...

A talk by @inconshreveable at The Strange Loop 2016 called "Idealized Commit Logs: Code Simplification via Program Slicing" about the amazing tools that can be built with program slicing inspired me to work on this project. Learn more about program slicing here.

This is actual output from slice-js (not yet open source), a program slicing tool that I'm working on right now. I can't wait to work out more kinks, make it more practically useful and show it to you all!

The match-sorter.js file is the transpiled CommonJS version of match-sorter and you can find that here.

@shuhei
shuhei / epic.js
Last active August 5, 2016 02:59
An idea of side-effect-free epic like redux-saga for redux-observable
// Explicit in-out of side-effect actions.
function epic(action$, store) {
const fooReq$ = action$.ofType('FOO')
.map(action => call('FOO_REQ', webapi.getFoo, action.payload.id));
const foo$ = action$.ofType('FOO_REQ')
.map(foo => ({ type: 'FOO_FETCHED', payload: { foo } }));
return Observable.merge(
fooReq$,
foo$
commit e6284b9bd6977ca282bdf13d13fab4d8bf6be71b
Normative: Add [?Yield] to PropertyName in AssignmentProperty
commit f0ef98ae9ecdfd1ed1e14721e795f6188a3107ee
Normative: Fix yield * semantics when calling .throw
commit 6ba35eb8fb9aad699efdd1766c52bc9f6401d039
Normative: update Annex B regexp grammar
commit d96e60a99a40fab2de0df329b3e5445ac27b8a8e
Normative: Remove [[Enumerate]] and associated reflective capabilities
commit 24dad16327b7cbbdf67805e45e58c54abe558f63
Normative: Require Unicode 8.0.0
@jonathanvdc
jonathanvdc / Struct.ds
Created March 1, 2016 17:54
Wasm Structs
// Compile with `dsc Struct.ds -platform wasm -Wno-build`
public struct Vector2
{
public int X;
public int Y;
public int LengthSquared()
{
return X * X + Y * Y;
@mjackson
mjackson / WindowScrollTo.js
Last active January 16, 2017 02:11
Make window.scrollTo declarative using a <WindowScrollTo> React component
import React from 'react'
import warning from 'warning'
const { number, object } = React.PropTypes
const WindowScrollTo = React.createClass({
contextTypes: {
windowScrollTo: object
},
@mhevery
mhevery / Zone.md
Last active March 30, 2022 11:54
TC39 Zone Proposal

Zone Motivation

Make writing asynchronous code easier by having a consistent way of propagating "context" across related asynchronous operations. Have the "context" be responsible for async-local-storage, allowing the execution before and after hooks, and "context"-local error handling. Finally make sure that the "context"s are composable.

This feature needs to be part of the platform so that library and framework authors can relay on a common well know API, otherwise adoption will be limited.

Pattern Matching

This is a strawman proposal for adding pattern matching to ECMAScript. Pattern matching is useful for matching a value to some structure in a similar way to destructuring. The primary difference between destructuring and pattern matching are the use cases involved - destructuring is useful for binding pieces out of larger structures whereas pattern matching is useful for mapping a value's structure to data or a set of behaviors. In practice this means that destructuring tends to allow many shapes of data and will do its best to bind something out of it, whereas pattern matching will tend to be more conservative.

Additionally, the power of pattern matching is increased substantially when values are allowed to participate in the pattern matching semantics as a matcher as well as a matchee. This proposal includes the notion of a pattern matching protocol - a symbol method that can be implemented by objects that enables developers to use those values in pattern matching. A common scenario w

@yurydelendik
yurydelendik / !wasmllvm.md
Last active May 31, 2024 06:31
Using WebAssembly in LLVM

NOTE: the content is out-of-date. All development is moved to the https://github.com/yurydelendik/wasmception

Using WebAssembly in LLVM

Compiling

# locations, e.g.
export WORKDIR=~/llvmwasm; mkdir -p $WORKDIR
export INSTALLDIR=$WORKDIR
@wmertens
wmertens / full stack redux.md
Last active February 8, 2022 22:46
making an awesome server with the redux model, Work In Progress

Thought experiment: Redux-like stateless server

Description

We describe a model for client-server processing where the Redux model is used to minimize stateful code. This should allow live-reloading server code, and make it possible to share code (e.g. optimistic updating) between client and server.

Dramatis Personae

  • Assume a server consisting of multiple worker processes that do not share memory and may be running on multiple hosts.
    • Workers have middleware, root reducers and an app state object
  • Workers can be dynamically added and removed