Skip to content

Instantly share code, notes, and snippets.

Avatar

Mikola Lysenko mikolalysenko

View GitHub Profile
View yahoo_gme_weird_volume_packet.json
{
"chart": {
"result": [
{
"meta": {
"currency": "USD",
"symbol": "GME",
"exchangeName": "NYQ",
"instrumentType": "EQUITY",
"firstTradeDate": 1013610600,
View vox-to-box.js
// install:
//
// npm install ndarray parse-magica-voxel
//
// usage:
//
// node vox-to-box.js my-file.vox > my-file.terrain
//
const parseMagicaVoxel = require('parse-magica-voxel')
View strawman-api.js
const HelNumber = require('helschema/number')
const HelString = require('helschema/string')
const HelStruct = require('helschema/struct')
const HelDictionary = require('helschema/dictionary')
const EntitySchema = HelStruct({
x: HelNumber,
y: HelNumber,
color: HelString
})
View gl-toaster.js
const regl = require('regl')()
const video = document.createElement('video')
video.src = 'mario.mp4'
video.currentTime = window.localStorage.getItem('currentTime') | 0
function persistVideoLocation () {
window.localStorage.setItem('currentTime', video.currentTime)
}
View regl-multiply-blend.js
const regl = require('regl')()
const drawCircle = regl({
attributes: {
p: [0] // dummy attribute
},
frag: `
precision highp float;
uniform vec3 color;
View blendMode.js
{
blend: {
enable: true,
func: {
src: 'dst color',
dst: 'one minus src alpha'
},
equation: 'add'
}
}
View fill-screen.js
module.exports = function (regl) {
return regl({
vert: `
precision highp float;
attribute vec2 position;
varying vec2 uv;
void main () {
uv = 0.5 * (position + 1.0);
gl_Position = vec4(position, 0, 1);
}
View drip.js
const regl = require('regl')({
extensions: 'OES_texture_float'
})
const fillScreen = require('./fill-screen')(regl)
const RESOLUTION = 256
const initialData = new Float32Array(RESOLUTION * RESOLUTION * 4)
for (var i = 0; i < initialData.length; ++i) {
initialData[i] = Math.random()
View bunny3d.js
const regl = require('regl')()
const calcNormals = require('angle-normals')
const mat4 = require('gl-mat4')
const bunny = require('bunny')
// coordinate systems:
//
// data --model--> world --view--> camera --projection--> device
//