Skip to content

Instantly share code, notes, and snippets.

View wiredearp's full-sized avatar

Wired Earp wiredearp

  • Wunderbyte
  • Denmark
View GitHub Profile
@manigandham
manigandham / rich-text-html-editors.md
Last active April 16, 2025 18:28
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors

@mauvm
mauvm / Jasmine-and-Babel6.md
Created November 12, 2015 10:51
Jasmine ES6 run script for use with Babel 6
$ npm install --save babel-cli babel-preset-es2015
$ npm install --save-dev jasmine

.babelrc:

{
 "presets": ["es2015"]
@jlongster
jlongster / immutable-libraries.md
Last active November 7, 2024 13:11
List of immutable libraries

A lot of people mentioned other immutable JS libraries after reading my post. I thought it would be good to make a list of available ones.

There are two types of immutable libraries: simple helpers for copying JavaScript objects, and actual persistent data structure implementations. My post generally analyzed the tradeoffs between both kinds of libraries and everything applies to the below libraries in either category.

Libraries are sorted by github popularity.

Persistent Data Structures w/structural sharing

@telekosmos
telekosmos / uniq.js
Last active November 15, 2022 17:13
Remove duplicates from js array (ES5/ES6)
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
};
var uniqEs6 = (arrArg) => {
return arrArg.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos;
});
@chocolateboy
chocolateboy / elvis.sjs
Last active August 29, 2015 14:15
sweet.js version of Groovy's Elvis operator
// Groovy's Elvis operator
//
// lhs ?: rhs
//
// is equivalent to:
//
// lhs == null ? rhs : lhs
//
// or:
//
@sebmarkbage
sebmarkbage / react-terminology.md
Last active January 9, 2023 22:47
React (Virtual) DOM Terminology
@allenwb
allenwb / 0Option2ConstructorSummary.md
Last active February 24, 2025 23:12
New ES6 constructor features and semantics: Alternative 2 manual super in derived classes

New ES6 Constructor Semantics and Usage Examples

Manual super: Alternative Design where subclass constructors do not automatically call superclass constructors

This Gist presents a new design of class-based object construction in ES6 that does not require use of the two-phase @@create protocol.

One of the characteristics of this proposal is that subclass constructors must explicitly super invoke their superclass's constructor if they wish to use the base class' object allocation and initialization logic.

An alternative version of this design automatically invokes the base constructor in most situations.

@tunderdomb
tunderdomb / currentScript.polyfill.js
Created June 25, 2014 14:56
document.currentScript polyfill (a really barebones one)
if ( typeof document.currentScript == "undefined" && document.__defineGetter__ ) {
document.__defineGetter__("currentScript", function (){
try {
throw new Error()
}
catch ( e ) {
var qualifiedUrl = location.protocol + "//" + location.host
, srcs = e.stack.match(new RegExp(qualifiedUrl + ".*?\\.js", 'g'))
, src = srcs[srcs.length - 1]
, absoluteUrl = src.replace(qualifiedUrl, "")
@staltz
staltz / introrx.md
Last active May 11, 2025 22:46
The introduction to Reactive Programming you've been missing
@pfrazee
pfrazee / gist:8958717
Last active February 26, 2020 11:25
Communicating with Workers using HTTP

Communicating with Workers using HTTP

A design rationale.

See first: In-Application Sandboxing with Web Workers.

Web Workers interact with their Host Pages using a messaging channel (the postMessage API). Crucially for their programming model, the messages are asyncronous. This introduces a significant challenge for implementing Page APIs within a Worker – for instance, how do you port a GUI widget from the Page (where it can access the DOM) to a Worker, where it can only send async messages?

In my experience, two categories of solutions are suggested: use code-transformations to recreate Page-native APIs in the Worker, or introduce a new interface around messaging. In this gist, I'll explain why code transformations don't address the problem fully, and present a complete messaging solution based on HTTP.