Skip to content

Instantly share code, notes, and snippets.

View ngnguyen1's full-sized avatar
🏠
Working from home

Nga Nguyen ngnguyen1

🏠
Working from home
  • FPT - Silicon Labs
  • Hà Nội
  • 03:25 (UTC +07:00)
  • LinkedIn in/nga-nguyen
View GitHub Profile
@ngnguyen1
ngnguyen1 / review-checklist.md
Created March 29, 2020 09:36 — forked from bigsergey/review-checklist.md
Front-end Code Review Checklist

Review checklist

General

  1. Does the code work?
  2. Description of the project status is included.
  3. Code is easily understand.
  4. Code is written following the coding standarts/guidelines (React in our case).
  5. Code is in sync with existing code patterns/technologies.
  6. DRY. Is the same code duplicated more than twice?
@ngnguyen1
ngnguyen1 / base64ArrayBuffer.js
Created March 29, 2020 08:57 — forked from jonleighton/base64ArrayBuffer.js
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@ngnguyen1
ngnguyen1 / rgb-array.js
Created October 16, 2019 02:59 — forked from henrahmagix/rgb-array.js
Get an rgb() array of any hex or rgb color.
(function() {
function getRgbArray(color, alpha) {
// Always return an array, either empty or filled.
var rgb = [];
var hex;
// Get an array of rgb(a) values.
if (color.substr(0, 1) === '#') {
/* HEX STRING */
// If the first character is # we're dealing with a hex string. Get
@ngnguyen1
ngnguyen1 / spacemacs-keybindings
Created May 19, 2018 02:39 — forked from adham90/spacemacs-keybindings
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |
@ngnguyen1
ngnguyen1 / font.js
Created May 18, 2018 09:46 — forked from andfinally/font.js
Cache webfont in localStorage
/**
* Adapted from https://gist.github.com/hdragomir/8f00ce2581795fd7b1b7
* This version tries to load the font from localStorage. If it's not there it simply adds a link to the stylesheet
* and ajaxes the contents in on load. This makes an extra request. But adding the stylesheet link renders quicker than
* waiting for a response to the ajax request and then injecting the contents into a style tag, hopefully minimising the
* FOUT you get when you view http://www.theguardian.com/ and http://www.smashingmagazine.com.
*/
(function () {
"use strict";
// Once cached the css file is stored on the client forever. To invalidate the cache change this URL.
@ngnguyen1
ngnguyen1 / .gitconfig
Created February 2, 2018 17:57 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
! `xev` and `showkey` to see which keycode is pressed
!old keys
!xmodmap -pke |grep Something
!keycode 50 = Shift_L ISO_Prev_Group Shift_L ISO_Prev_Group
!keycode 62 = Shift_R ISO_Next_Group Shift_R ISO_Next_Group
!keycode 66 = Caps_Lock NoSymbol Caps_Lock
!keycode 22 = BackSpace BackSpace BackSpace BackSpace NoSymbol NoSymbol Terminate_Server
!keycode 37 = Control_L NoSymbol Control_L
@ngnguyen1
ngnguyen1 / password.js
Created December 27, 2015 03:05 — forked from soplakanets/password.js
Password hashing for node.js
var crypto = require('crypto');
var SaltLength = 9;
function createHash(password) {
var salt = generateSalt(SaltLength);
var hash = md5(password + salt);
return salt + hash;
}
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html