Skip to content

Instantly share code, notes, and snippets.

View trongthanh's full-sized avatar
🎈
Keep calm and code on

Thanh Tran trongthanh

🎈
Keep calm and code on
View GitHub Profile
@trongthanh
trongthanh / marco-compton.conf
Last active March 21, 2022 10:06 — forked from vemacs/compton.conf
Sensible marco-compton.conf for Ubuntu MATE 18.10 (and fix shadow at Ulauncher search panel)
# For Ubuntu MATE, save this config file at ~/.config/marco-compton.conf
#################################
#
# Backend
#
#################################
# Backend to use: "xrender" or "glx".
# GLX backend is typically much faster but depends on a sane driver.
@trongthanh
trongthanh / hook-fns.js
Last active November 1, 2018 04:25 — forked from getify/1.js
experiment: mimicking React's new "useState()" hook for stand-alone functions.
/**
* Note: I have forked this gist from @getify to rewrite it with variable naming with closer association with hook and state
* and added some comments of my own so that it is easier to follow
* A demo is live at: https://codepen.io/trongthanh/pen/WaqqoJ?editors=0012
*/
'use strict';
[foo, bar] = enableHooks(foo, bar);
function foo(origX, origY) {
@trongthanh
trongthanh / dabblet.css
Created December 10, 2014 04:37 — forked from oli/dabblet.css
Animations plus animations/transitions
/* Animations plus animations/transitions */
/* ref: http://mattwilcox.net/sandbox/css3-animations-1/index.htm */
/* also ref: http://css-tricks.com/restart-css-animation/ */
.animate-on-load {animation: bgcolor 3s;}
.animate-on-hover:hover {animation: bgcolor 3s;}
.animate-on-hover2:hover {animation: bgcolor2 3s;} /* change anim name */
.animate-on-hover3:hover {animation: bgcolor 2.9s;} /* change duration */
.animate-on-hover4:hover {animation: bgcolor 3s 2;} /* change iteration-count */
.transition-on-hover {transition: background-color 2s;}
.transition-on-hover:hover {background-color: #777;}
@trongthanh
trongthanh / perspectiveProject.js
Created October 18, 2011 04:35 — forked from jsermeno/perspectiveProject.js
Three.js Transform 3D coordinates to screen coordinates and back in perspective projection - http://catchvar.com/threejs-game-transforming-isometric-screen-co
var
projector = new THREE.Projector(),
p3D = new THREE.Vector3(25, 15, 9),
p2D;
p2D = projector.projectVector(p3D, camera);
p3D = projector.unprojectVector(p2D, camera);
//need extra steps to convert p2D to window's coordinates
p2D.x = (p2D.x + 1)/2 * window.innerWidth;