Skip to content

Instantly share code, notes, and snippets.

import { Observable } from "rxjs";
Observable.prototype[Symbol.asyncIterator] = createAsyncIterator;
async function* createAsyncIterator() {
const promise = [];
const values = [];
let done = false;
let error = null;
@sebmarkbage
sebmarkbage / Infrastructure.js
Last active February 26, 2025 13:57
SynchronousAsync.js
let cache = new Map();
let pending = new Map();
function fetchTextSync(url) {
if (cache.has(url)) {
return cache.get(url);
}
if (pending.has(url)) {
throw pending.get(url);
}
@rollacaster
rollacaster / algebraic-structures.txt
Created October 21, 2017 13:01
Algebraic Structures
https://drboolean.gitbooks.io/mostly-adequate-guide
http://www.tomharding.me/2017/03/03/fantas-eel-and-specification/
https://egghead.io/courses/professor-frisby-introduces-composable-functional-javascript
https://github.com/fantasyland/fantasy-land
@robinfehr
robinfehr / TimeMachine.js
Last active July 10, 2017 18:17
mobx-state-tree time travelling
import { QueryStore } from './Query/QueryStore/Store';
import { clone, onAction, onPatch, getSnapshot, applySnapshot, applyAction, onSnapshot } from 'mobx-state-tree';
import { runInAction } from 'mobx';
import { actions } from '../Actions/';
var initialState = null;
var snapshots = [];
var maxSteps = 100;
var currentSnapshot = 0;
@tkh44
tkh44 / Animation.jsx
Last active April 6, 2025 09:18
react-router v4 animated with data-driven-motion
import React from 'react'
import { BrowserRouter as Router, Route, Link, Redirect, matchPath } from 'react-router-dom'
import { Motion } from 'data-driven-motion' // https://github.com/tkh44/data-driven-motion
const WOBBLY_SPRING = { stiffness: 200, damping: 15, precision: 0.1 }
const AnimationExample = () => (
<Router>
<div>
<ul>
@OdeToCode
OdeToCode / Program.cs
Created September 16, 2016 19:04
Some quick code to show assembly name, version, and load path in Program.cs of AspNet Core
var assemblies = Assembly.GetEntryAssembly().GetReferencedAssemblies();
foreach (var assembly in assemblies)
{
Console.WriteLine($"{assembly.Version} {assembly.Name}");
var codebase = Assembly.Load(assembly).CodeBase.Replace("file:///", "");
Console.WriteLine($"\t{Path.GetDirectoryName(codebase)}");
}
@nikgraf
nikgraf / reactive-2016.md
Last active August 5, 2021 15:31
Proposal for lightning talk at Reactive Conf 2016

Rich text editing with DraftJS Plugins

Earlier this year Facebook open sourced its React based rich text editing framework Draft.js. At Facebook it powers status updates, comments & notes. Others used it to build editors matching Medium’s experience.

Together with a whole team of open source contributors I built a plugin architecture on top of Draft.js. In this talk I walk you through the existing plugins and show how you can build your own feature-rich text editor for the web with only a handful lines of code. 🤓

Draft JS Plugins Logo

https://code.jquery.com/jquery-2.2.4.min.js
@IanMercer
IanMercer / JsonPatches.cs
Created July 5, 2016 21:17
JSONPatch - a simple, crude implementation of calculating and applying patches to Json objects
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Abodit
{
public class JPatch
{
public string op { get; set; } // add, remove, replace
@davidfowl
davidfowl / Example1.cs
Last active February 11, 2026 04:57
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)