Skip to content

Instantly share code, notes, and snippets.

View kaosat-dev's full-sized avatar

Mark Moissette kaosat-dev

View GitHub Profile
@kylemcdonald
kylemcdonald / convert.py
Last active February 9, 2025 09:47
Scrape ShaderToy. Instead of running this, consider downloading the files from here: https://goo.gl/MWGvkL Or if you want to do more work with ShaderToy data, consider using their API https://www.shadertoy.com/api
# !/usr/bin/env python
import os, re, argparse, json
parser = argparse.ArgumentParser(
description='Extract code from ShaderToy json.')
parser.add_argument('input')
parser.add_argument('output')
args = parser.parse_args()
@mattdesl
mattdesl / electron-server.js
Last active March 23, 2019 20:58
electron reloading
var budo = require('budo')
var server = budo('src/client.js')
.on('connect', function (ev) {
mainWindow.loadUrl(ev.uri)
mainWindow.once('close', function () {
server.close()
})
})
.on('update', function(file, contents) {
@bsergean
bsergean / README.md
Last active March 8, 2022 01:23
offscreen rendering with three.js and headless-gl, in coffee-script

Getting the code

git clone https://gist.github.com/6780d7cc0cabb1b4d6c8.git

Executing the code

$ npm install # maybe npm start will take care of it but just in case
$ npm start && open out.png

> [email protected] start /Users/bsergean/src/offscreen_sample

@yvele
yvele / line-by-line-rxjs-node.js
Created October 22, 2015 09:52
Line by line file reading with RxJS on Node.js
var Rx = require('rx');
var readline = require('readline');
var fs = require('fs');
var rl = readline.createInterface({
input: fs.createReadStream('lines.txt')
});
var lines = Rx.Observable.fromEvent(rl, 'line')
.takeUntil(Rx.Observable.fromEvent(rl, 'close'))
@gorangajic
gorangajic / es6-spread-immutable-cheatsheet.md
Last active December 19, 2025 05:46
es6 spread immutable cheatsheet

update object

var state = {
    id: 1,
    points: 100,
    name: "Goran"
};

var newState = {
@jamestalmage
jamestalmage / How_Require_Extensions_Work.md
Last active February 28, 2024 18:22
Breakdown of How Require Extensions Work

Why

Doing require extensions correctly is essential, because:

  1. Users should be able to install multiple extensions in succession, and have them work together.
  2. Coverage tools like nyc need it to reliably supply coverage information that takes into account sourcemaps from upstream transforms.
  3. Because non-standard, un-predictable behavior causes hard to solve bugs, and major headaches for project maintainers.

What is a require extension anyways?

@benjyhirsch
benjyhirsch / 0-description.md
Last active February 4, 2016 22:00
Inspired by Cycle.js and Motorcycle.js

I was playing around with functional and reactive programming in Javascript, and the UI framework Cycle.js. In order to better understand how that framework works, I pared down the core functionality to a single concept: given a function that takes in an input stream and returns an output stream, resolve the circular dependency of feeding its output back into itself as input. I also built a naive re-implementation of the core Cycle.run command on top of that.

@kgryte
kgryte / proxy.js
Created December 24, 2015 03:48
Using ES6 proxy with arrays.
/* jshint esnext:true */
function get( target, prop, receiver ) {
console.log( 'target: ' + target );
console.log( 'property: ' + prop );
// console.log( 'Receiver: ' + receiver );
return Reflect.get( target, prop, receiver );
}
var handler = {
@volodymyrprokopyuk
volodymyrprokopyuk / railway_oriented_programming.js
Last active October 6, 2020 04:50
Railway Oriented Programming (JavaScript)
var _ = require('lodash');
var Success = function(success) { this.success = success; };
var Failure = function(failure) { this.failure = failure; };
var bindAll = function(fs) {
var bind = function(res, f) {
return res instanceof Success ? f(res.success) : res;
};
var bindF = function(f) { return _.partial(bind, _, f); };
@manekinekko
manekinekko / regex-es6-imports.js
Last active July 7, 2025 10:54
A regular Expression to parse ECMAScript6 import syntax
let regex = `import
(?:
["'\s]*
([\w*{}\n, ]+)
from\s*
)?
["'\s]*
([@\w/_-]+)
["'\s]*
;?