Skip to content

Instantly share code, notes, and snippets.

View thuongvu's full-sized avatar

Thuongvu Ho thuongvu

  • Chime
  • San Francisco
View GitHub Profile
@thuongvu
thuongvu / Makefile
Created August 10, 2020 19:07 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@thuongvu
thuongvu / latency.markdown
Created January 7, 2019 18:08 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@thuongvu
thuongvu / 01-intro.md
Last active August 29, 2015 14:21 — forked from dwayne/01-intro.md

Introduction

Author: Ari Lerner.

AngularJS offers a single framework that can be used to build dynamic, client-centric applications. It provides:

  • Module support
  • DOM manipulation
  • Animations
  • Templating
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
/*
* There's a bug in Chrome/Safari using overflow:hidden with border-radius. This mask fixes it.
* Solution: http://stackoverflow.com/questions/5736503/how-to-make-css3-rounded-corners-hide-overflow-in-chrome-opera/10296258#10296258
*/
.masked {
position: absolute;
border-radius: 10px;
overflow: hidden;
/* this fixes the overflow:hidden in Chrome */
-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);
@thuongvu
thuongvu / 01_shapesLibrary.js
Last active August 29, 2015 14:01
Utility functions/classes for svg
(function(shape) {
// utility
var getSet = function(propertyName, _property) {
if (_property) {
this['_' + propertyName] = _property;
return this;
} else {
return this['_' + propertyName];
};
};
@thuongvu
thuongvu / 0_script.js
Last active August 29, 2015 13:58
Tic Tac Toe game in "vanilla" JavaScript
// Main script
(function() {
var Game = {
startGame: function() {
this.inSession = 1,
this.player1Turn = true,
this.claimed = [],
this.gameBoardState = [null, 1,2,3,4,5,6,7,8,9],
this.winner = null;
this.count = 0;