Skip to content

Instantly share code, notes, and snippets.

@ryancat
ryancat / ModuleAPrototype.d.ts
Created October 21, 2018 07:31
typescript migration demo
// Stop-gap declaration file for typescript migration
export {};
@ryancat
ryancat / ModuleAPrototype.js
Last active October 22, 2018 06:37
typescript migration demo
var ModuleC = require('./ModuleC.js');
module.exports = {
initModuleA: function (config) {
this.config = config;
},
log: function (message) {
console.log('[ModuleA]', message);
},
@ryancat
ryancat / ModuleA.ts
Last active October 22, 2018 06:35
typescript migration demo
// typescript will give error: An import path cannot end with a '.ts' extension.
// this is just for clarification purpose!
import { IModuleAConfig } from './types.ts';
import * as ModuleAPrototype from './ModuleAPrototype.js';
class ModuleA {
constructor(config: IModuleAConfig) {
this.initModuleA(config);
}
@ryancat
ryancat / myLibApi.js
Last active October 22, 2018 06:39
typescript migration demo
// typescript will give error: An import path cannot end with a '.ts' extension.
// this is just for clarification purpose!
var ModuleA = require('./ModuleA.ts');
var ModuleB = require('./ModuleB.js');
module.exports = {
ModuleB: ModuleB,
run: function () {
const moduleA = new ModuleA({
@ryancat
ryancat / myLib.ts
Last active October 22, 2018 06:39
typescript migration demo
// typescript will give error: An import path cannot end with a '.ts' extension.
// this is just for clarification purpose!
import ModuleA from './ModuleA.ts';
import * as myLibTypes from './types.ts';
import * as myLibApi from './myLibApi.js';
const myLib = {
ModuleA,
// Need to expose types so that consumers can use them
myLibTypes,
@ryancat
ryancat / ModuleA.js
Last active October 22, 2018 06:41
typescript migration demo
var ModuleC = require('./ModuleC.js');
var ModuleA = function (config) {
this.config = config;
};
ModuleA.prototype = {
log: function (message) {
console.log('[ModuleA]', message);
},
@ryancat
ryancat / myLib.js
Last active October 22, 2018 06:42
typescript migration demo
var ModuleA = require('./ModuleA.js');
var ModuleB = require('./ModuleB.js');
module.export = {
ModuleA: ModuleA,
ModuleB: ModuleB,
run: function () {
const moduleA = new ModuleA({
name: 'my module A',
@ryancat
ryancat / d3.note.md
Last active June 10, 2018 22:53
Thoughts on revisit d3js

Notes and thoughts on d3js after 4 years

I worked with d3js in 2014/2015, on some reporting web application where I need to draw bi-direction horizontal bar charts. I was supprised on how simple it was to get started, and became very flexible even when I need to have very customized chart requirements. Later I moved to another company where I am working on large scale data visualization, which I was told d3 will not be good enough to handle the large dataset we have. In our usecase, we want to render up to 1 to 2 million marks in browser with good performance. We ended up created our own charting engine, which gives us pretty amazing results with canvas (instead of SVG in d3).

Now it's 2018, d3 had made its name in data visualization world. I want to come back and revisit it, not only to get myself refreshed on new features and cool demoes, but also try to figure out if large scale data is still a deal breaker for d3. A quick search leads me to many interesting links, including [WORKING WITH D3.JS AND C

@ryancat
ryancat / tensorflow.recommendation.note.md
Last active May 30, 2018 05:05
Notes taken from building a tensorflow recommendation engine
@ryancat
ryancat / webgl.note.md
Last active March 27, 2020 16:55
Notes taken from learning webgl related topics.

Webgl related notes

Resources are referenced from the following links:

Summary

  • webgl is a state machine and a graphic pipeline. It holds an internal state and allow user update them.
  • When ready to render, there are a handful of methods webgl provides to 'clear' the viewport, with the current internal state defined.
  • We are always drawing 3D object in canvas using webgl.