Skip to content

Instantly share code, notes, and snippets.

@ryancat
ryancat / cPlusPlus.mm
Created August 20, 2020 05:32
Learning C++ note
<map version="1.0.1">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1597595675123" ID="ID_1480064371" MODIFIED="1597597165767" TEXT="C++">
<node CREATED="1597595687402" ID="ID_4167567" MODIFIED="1597595718168" POSITION="right" TEXT="IDE">
<node CREATED="1597595718169" ID="ID_436473551" MODIFIED="1597595737554" TEXT="Mac: Xcode" />
<node CREATED="1597595723311" ID="ID_140828934" MODIFIED="1597595748163" TEXT="Windows: Visual Studio" />
</node>
<node CREATED="1597595857826" ID="ID_311037127" MODIFIED="1597595868137" POSITION="left" TEXT="Basic Syntax">
<node CREATED="1597595868139" ID="ID_1918807677" MODIFIED="1597595880384" TEXT="Variables" />
<node CREATED="1597595880967" ID="ID_1905319404" MODIFIED="1597595883049" TEXT="Pointers" />
@ryancat
ryancat / aseprite_install.sh
Last active June 24, 2024 02:47
Download and install aseprite
#!/bin/bash
# Must have git, homebrew, and xcode to install
# Make sure to change line 29 and line 30 according to your mac OS and xcode versions
# Install ninja compiler
brew install ninja
# Install CMake for makefile
brew install cmake
@ryancat
ryancat / README.md
Created January 21, 2020 23:15
Popular data visualization library
@ryancat
ryancat / bootstrap.js
Last active April 4, 2019 00:40
Run npm install in all packages defined by lerna.json
// Assume this file is next to lerna.json
// Otherwise the path to lerna.json needs to be updated (line 9)
// Credits: http://2ality.com/2018/05/child-process-streams.html
const fs = require('fs')
const path = require('path')
const glob = require('glob')
const { spawn } = require('child_process')
/*** Step 1. Get lerna.json config ***/
@ryancat
ryancat / howToCombineRepo.md
Last active April 23, 2019 20:58
How to merge one repo into another repo's sub directory

How to add another repo foo under current repo's subdirectory bar/my_foo?

First time add repo under subdirectory

It's easy to add foo for the first time. Just run the following one-liner to add foo's remote master branch to bar/my_foo

git subtree add --prefix=bar/my_foo REMOTE_PATH_TO_FOO master

You can optionally add --squash in the end to squash all commit history if that's what you want.

Update bar/my_foo with new changes in foo repo

@ryancat
ryancat / ModuleC.d.ts
Created October 21, 2018 21:12
typescript migration demo
// Stop-gap declaration file for typescript migration
export {};
@ryancat
ryancat / types.ts
Last active October 21, 2018 21:48
typescript migration demo
// module types
export enum ModuleType {
Smart = 'smart',
Dumb = 'dumb',
}
// moduleA config data types
export interface IModuleAConfig {
name: string;
type: ModuleType;
@ryancat
ryancat / myLibApi.d.ts
Created October 21, 2018 18:59
typescript migration demo
// Stop-gap declaration file for typescript migration
export {};
@ryancat
ryancat / ModuleA.d.ts
Last active October 22, 2018 06:33
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';
declare class ModuleA {
constructor(config: IModuleAConfig);
private initModuleA;
}
export = ModuleA;
@ryancat
ryancat / ModuleAPrototype.d.ts
Created October 21, 2018 07:31
typescript migration demo
// Stop-gap declaration file for typescript migration
export {};