Skip to content

Instantly share code, notes, and snippets.

View thangkieu's full-sized avatar
:octocat:

Thang Kieu thangkieu

:octocat:
View GitHub Profile
@thangkieu
thangkieu / sample-nginx.conf
Created November 30, 2018 08:14 — forked from dimitardanailov/sample-nginx.conf
Configuration for single page application(Framework: Angularjs, Web server: Nginx)
server {
listen 80 default deferred;
server_name myapp.com;
root /var/www/project-folder/;
# Nginx and Angularjs with html mode 5 - https://gist.github.com/cjus/b46a243ba610661a7efb
index index.html;
@thangkieu
thangkieu / img-loader.js
Last active September 9, 2021 04:04
Render a temporary image by JavaScript
/**
* Convert Image from Url to Base64 data
* @param {string} url Image url
* @param {Function} callback Callback receive the Base 64 data
* @returns void
*/
async function loadImg(imgUrl, callback) {
const file = await fetch(imgUrl, { headers: { 'Content-Type': 'blob' } });
if (file.status !== 200) return;

Some git tips

I. Reset pushed branch to older commit

Do the following step to reset a pushed branch to specific commit

  1. git log: run this command to log all of history to get the commit hash, it look like a9dec62f265a75fa97367238f1fffcaaad3392f0. Copy the hash.
  2. Firstly, reset your remote branch to destination commit by hash: git push -f origin [hash-string]:[branch-name]
  3. Reset your local branch to destination commmit: git reset [optional, type of reset --hard] [hash-string]
  4. Done