Skip to content

Instantly share code, notes, and snippets.

View hollasch's full-sized avatar

Steve Hollasch hollasch

View GitHub Profile
// http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0199239
const float kCividisLUT[][3] =
{
0.0000f, 0.1262f, 0.3015f,
0.0000f, 0.1292f, 0.3077f,
0.0000f, 0.1321f, 0.3142f,
0.0000f, 0.1350f, 0.3205f,
0.0000f, 0.1379f, 0.3269f,
0.0000f, 0.1408f, 0.3334f,
0.0000f, 0.1437f, 0.3400f,
@Leandros
Leandros / random.h
Created July 2, 2018 05:22
C++ Pseudo Random Number Generators
/* Copyright (c) 2018 Arvid Gerstmann. */
/* This code is licensed under MIT license. */
#ifndef AG_RANDOM_H
#define AG_RANDOM_H
class splitmix
{
public:
using result_type = uint32_t;
static constexpr result_type (min)() { return 0; }
// A cooperative-"multithreading" JavaScript routine to allow asynchronous rendering and
// display without the cost of WebWorker serialization. -- @CasualEffects
var updateImageData = ctx.createImageData(screenWidth, screenHeight);
var updateImage = document.createElement('canvas');
updateImage.width = screenWidth;
updateImage.height = screenHeight;
var makeRenderLoop = function*() {
while (true) {
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 17, 2024 09:42
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@hugolpz
hugolpz / README.md
Last active December 7, 2023 17:18
.data() vs .datum()

This project aim to illustrate with code the similarities and differences between .data() and .datum(). Feel free to fork and add other parallel examples, where .data() and .datum() do the same work with different syntaxes.

.data() and .datum()'s generated elements are taggued and get collored accordingly using CSS class) :

.data:hover  { fill: #B10000; opacity: 1; } /*  data = RED   */
.datum:hover { fill: #00B100; opacity: 1; } /*  datum= GREEN */

Syntax

@banksean
banksean / mersenne-twister.js
Created February 10, 2010 16:24
a Mersenne Twister implementation in javascript. Makes up for Math.random() not letting you specify a seed value.
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();