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 / dabblet.css
Created March 17, 2013 06:53
Flex-box playground
/**
* Flex-box playground
*/
body { font: 2em sans-serif; }
.s1 { font-size: 1em; }
.s2 { font-size: 2em; }
.s3 { font-size: 1.5em; }
.box {
background: #ffcccc;
@trongthanh
trongthanh / demo.html
Created July 12, 2012 03:30
Google Swiffy Hacks
Visit: http://jsfiddle.net/ttt_conan/bzqnu/ for live demonstration
@trongthanh
trongthanh / gist:2779392
Last active April 9, 2025 01:49
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.
@trongthanh
trongthanh / dabblet.css
Created May 10, 2012 06:42
Animated 3D Stereo Images with CSS3
/**
* Animated 3D Stereo Images with CSS3
* Author: Thanh Tran (int3ractive.com)
*/
.image1 {
background: url(http://labs.int3ractive.com/javascript/effects/stereo-images/img/DSC_0192.jpg) no-repeat;
width: 512px;
height: 769px;
}
@trongthanh
trongthanh / dabblet.css
Created April 17, 2012 05:19
Realistic CSS3 Waterfall
/**
* Realistic CSS3 Waterfall
* Author: Thanh Tran
* License: MIT
* Tutorial: http://blog.int3ractive.com/2012/04/tutorial-realistic-waterfall-with-css3.html
* Image courtesy: http://wolffanticy.webs.com/waterfallcavepack.htm
*/
/* Container with the static waterfall background image */
.waterfall {
@trongthanh
trongthanh / gist:2258994
Created March 31, 2012 03:34
Convert dash-separated properites to camel case ones
# Using vim
:%s/-\(.\)/\U\1/g
# Explain: Search for pattern -(.) and turn uppercase the first group \U\1
@trongthanh
trongthanh / gist:2048765
Created March 16, 2012 06:21
Git commands to pull remote and merge with current branch
# save current changes (if any) to stash
git stash save
# pull remote changes to local
git pull origin
# apply stash and try auto merge
git stash pop
# OR
git stash apply
@trongthanh
trongthanh / gist:1823062
Created February 14, 2012 03:09
export a git revision
# Can use a short revision id (3ec090f) in place of master to export a specific revision
git archive --format zip --output ../zipfile.zip master
@trongthanh
trongthanh / clear_svn.sh
Created October 18, 2011 06:16
Search for .svn folders and remove them. (Remove all subversion metadata folders)
$ find . -name '.svn' -exec rm -R -f '{}' \;
@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;