This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function n(type, attrs, children) { | |
var elem = document.createElement(type) | |
for (var attr in attrs) { | |
if ({}.hasOwnProperty.call(attrs, attr)) { | |
elem[attr] = attrs[attr] | |
} | |
} | |
(function append(e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DEFAULT_MESSAGE = 'This function will be removed in future versions.' | |
deprecate[Symbol.decoratorCall] = deprecate | |
export default function deprecate(message = DEFAULT_MESSAGE, options = {}) { | |
if (options.url) message += `\n\n See ${options.url} for more details.\n\n` | |
return (target, prop, descriptor) => { | |
if (typeof descriptor.value !== 'function') { | |
throw new SyntaxError('Only functions can be marked as deprecated') | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add and check that a path exists in a tree. | |
// | |
// Notes: | |
// 1. The comparison algorithms assume the paths are already resolved. | |
// 2. `matchEnd` is a sentinel to mark a leaf end of the cache tree. | |
// 3. Windows drive letters are intentionally included in the cache. | |
const path = require("path") | |
const hasOwn = Object.prototype.hasOwnProperty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This is licensed under CC0. */ | |
/** | |
* Notes: | |
* 1. This is fully ES3 compatible and works with the ES5 sham, but it leverages | |
* ES6's `WeakMap` or `Map` where possible. | |
* 2. This proxies `m`'s properties to Mithril's constructor where possible (in | |
* modern browsers, it always does). If you use the ES5 shams of | |
* `Object.defineProperty`, `Object.getOwnPropertyNames`, or | |
* `Object.getOwnPropertyDescriptor`, it should still properly proxy changes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given a list of M integers, find those whose sum is N | |
#include <list> | |
#include <string> | |
#include <iostream> | |
#include <cassert> // assert | |
// This could be anything, and this is the expected sum | |
#define EXPECTED 72 | |
// This is the general "run things" function. It scales to any number of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm-debug.log | |
node_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict" | |
// This is a basic TAP-generating reporter. | |
const tty = require("tty") | |
const inspect = require("util").inspect | |
const EventEmitter = require("events").EventEmitter | |
const windowWidth = (() => { | |
if (tty.isatty(1) && tty.isatty(2)) { |
Yes, this is a very significant departure from web workers, the current browser concurrency model. But I feel the lower level, more tightly integrated nature of it will make it far faster and lighter in practice, while still avoiding some significant footguns and working with the traditional single-threaded nature of JavaScript. Additionally, raw objects are much easier to deal with than pure message passing with workers.
So here's my idea:
// parent.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Possible Java equivalent. | |
package com.isiahmeadows.thallium.internal.cli; | |
import java.util.*; | |
import jscli.interpret.Interpret; | |
import com.isiahmeadows.thallium.internal.types.*; | |
import com.isiahmeadows.thallium.Thallium; | |
public class LoaderUtils { | |
private LoaderUtils() {} |