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 / initialize.sh
Last active May 17, 2020 10:41
Ubuntu Node Server Setup
#!/bin/bash
# NOTE: The commands here only applicable for Ubuntu 16.04 Xenial, do not use it for other distros
# Update server to latest packages
sudo apt update && sudo apt upgrade -y
# Install nginx and git
sudo apt install -y nginx git
@trongthanh
trongthanh / fetch-data.js
Created October 19, 2016 06:26
Intro to GraphQL
/**
* Client-side GraphQL data fetch example with HTML5 Fetch API
*
* @param {String} url URL to the GraphQL endpoint
* @param {String} query The GraphQL query
* @return {Promise} the request resolving promise object
*/
function fetchData(url = 'http://localhost:3000/graphql', query = '{ hello }') { //eslint-disable-line no-unused-vars
let requiredHeaders = new Headers({
'Content-Type': 'application/json',
@trongthanh
trongthanh / vn-front-end-libraries.md
Last active August 29, 2015 14:13
Front End Libraries by Vietnamese Developers

I'm not recommending nor disapproving any of these libraries. I'm listing these libraries / frameworks for just the fact that they were created by Vietnamese developers and I respect them for their hardwork and sharing with community:

  1. HTMLJS by nhanfu: A MVVM framework
  2. jQuery.longShadow by dangvanthanh: A jQuery plugin to create long casting shadows on text
  3. SickelS by singggum3b: A responsive web framework
@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 / dabblet.css
Created October 23, 2014 07:19
Position Property & Absolute Positioning Context Demo
/**
* Position Property & Absolute Positioning Context Demo
*/
div {
padding: 10px;
}
.main {
width: auto;
border: 5px solid lightgreen;
background-color: AliceBlue;
@trongthanh
trongthanh / AppView.js
Last active March 2, 2017 16:41
Maintainable JavaScript - From Zero to Hero
define(
['TodoItem'],
function(TodoItem) {
'use strict';
// constants
var ENTER_KEY = 13;
function AppView($el) {
this.$el = $el;
@trongthanh
trongthanh / Gruntfile.js
Created August 18, 2014 10:36
Working with HTML Forms Demo
/*jshint node: true*/
module.exports = function (grunt) {
'use strict';
// mannual grunt task loading:
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
// install and turn on package below to automatically load grunt tasks listed in the initConfig
// require('load-grunt-tasks')(grunt);
@trongthanh
trongthanh / dabblet.css
Created August 5, 2014 00:57
Position Property & Positioning Context Demo
/**
* Position Property & Positioning Context Demo
*/
div {
padding: 10px;
/*NOTE: box-sizing is natural (content-box)*/
}
.main {
width: auto;
border: 5px solid lightgreen;
@trongthanh
trongthanh / dabblet.css
Created August 3, 2014 05:22
Position Property & Positioning Context Demo
/**
* Position Property & Positioning Context Demo
*/
div {
padding: 10px;
}
.main {
width: auto;
border: 5px solid lightgreen;
background-color: AliceBlue;
@trongthanh
trongthanh / dabblet.css
Created August 3, 2014 04:44
Stacking Context Demo
/**
* Stacking Context Demo
*/
* { box-sizing: border-box; }
body { font-size: 20px; font-family: sans-serif; }
div {
border: 1px dashed black;
min-width: 10em;
min-height: 5em;
padding: 0.5em 1em;