Skip to content

Instantly share code, notes, and snippets.

View ashnur's full-sized avatar
🐢
fragments of scrolls surround me

Aron Gabor ashnur

🐢
fragments of scrolls surround me
View GitHub Profile
@XVilka
XVilka / TrueColour.md
Last active April 27, 2025 10:17
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@robotlolita
robotlolita / 0-specification.md
Last active January 1, 2016 01:29
Monadic Futures specification

A future should provide the fork, of, chain, and orElse methods, subject to the following rules:

new Future(computation)

  1. The computation should fulfil the type (α → γ), (β → γ) → γ.
  2. The value should be stored in the internal field [[Computation]], as-is.
  3. If computation is not a function, the behaviour is undefined.

Future.prototype.fork(f, g)

@imbcmdth
imbcmdth / later.js
Last active December 29, 2015 22:59
later function
var later = Function.bind.bind(window.setTimeout, window);
// Usage
element.addEventListener('click', later(foo, 1000));
// On click, `foo` will be executed after 1 second with the usual event parameters passed along
@robotlolita
robotlolita / loops-are-evil.md
Last active March 2, 2022 17:19
Why `xs.each(f)` should not be considered a "loop".

First and foremost, let's take a look at the following pieces of code. The first one is something you should be rather familiar with, and the second one is also a somewhat familiar idiom these days (at least in languages with higher-order functions):

// Example 1:
30 + 12

// Example 2:
xs.map(f)
@evancz
evancz / NameEntry.elm
Created October 25, 2013 15:41
Examples of markdown interpolation in Elm's markdown branch: https://github.com/evancz/Elm/tree/markdown
import Graphics.Input as Input
import String
main = lift2 scene textBox name
(textBox, name) = Input.field "What is your name?"
scene textBox name = [markdown|
{{ textBox }}
@Raynos
Raynos / example.js
Last active December 20, 2015 01:49
Observable array
var parent = getParentElement()
viewModel.slots(function (data) {
var diff = data.diff
var index = diff[0]
var newItem = diff[2]
var deleteAmount = diff[1]
if (newItem) {
var elem = renderNewElement(newItem)
@willurd
willurd / web-servers.md
Last active April 30, 2025 05:50
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@johan
johan / grep.js
Created May 9, 2013 21:49
Use grep to find direct/inherited properties of an object or function, or grep.own for direct properties only. (Great for Chrome 29's devtools' Script snippets panel.)
/* Examples:
Use grep with two arguments to find inherited or direct properties of an object:
> grep(document, 'get') // see all properties case insensitively matching *get*:
{ getCSSCanvasContext: function getCSSCanvasContext() { [native code] }
, getElementById: function getElementById() { [native code] }
, getElementsByClassName: function getElementsByClassName() { [native code] }
, getElementsByName: function getElementsByName() { [native code] }
, getElementsByTagName: function getElementsByTagName() { [native code] }
@Raynos
Raynos / exploration.md
Last active August 18, 2022 22:31
Exploration of a TodoMVC app using FRP javascript techniques.

Implementing TodoFRP in JavaScript

FRP to me means building your app by transforming values over time, from the input to the current state to the display.

This implementation is based on a the [graphics][1] library and is heavily inspired by [Elm][2]

A full implementation of TodoFRP can be found [online at Raynos/graphics example server][3]

Moving away from MVC

@domenic
domenic / interop.md
Last active July 7, 2022 19:47
`module.exports =` and ES6 Module Interop in Node.js

module.exports = and ES6 Module Interop in Node.js

The question: how can we use ES6 modules in Node.js, where modules-as-functions is very common? That is, given a future in which V8 supports ES6 modules:

  • How can authors of function-modules convert to ES6 export syntax, without breaking consumers that do require("function-module")()?
  • How can consumers of function-modules use ES6 import syntax, while not demanding that the module author rewrites his code to ES6 export?

@wycats showed me a solution. It involves hooking into the loader API to do some rewriting, and using a distinguished name for the single export.

This is me eating crow for lots of false statements I've made all over Twitter today. Here it goes.