Skip to content

Instantly share code, notes, and snippets.

View vuongtran's full-sized avatar
🎯
Focusing

Vuong vuongtran

🎯
Focusing
  • Ho Chi Minh City, Vietnam
View GitHub Profile
@vuongtran
vuongtran / awesome_tech_job.txt
Last active August 17, 2021 02:38
Awesome Tech Job | Hunting List A collection of awesome places to job hunt for people in tech. Compiled resources for developers
Popular Sites to Job Hunt
AngelList - https://angel.co
GitHub: http://jobs.github.com
Mashable: http://jobs.mashable.com/jobs
Indeed: http://indeed.com
StackOverflow: http://stackoverflow.com/jobs
LinkedIn: http://linkedIn.com
Glassdoor: http://glassdoor.com
Dice: http://dice.com
Monster: http://monster.com
@vuongtran
vuongtran / loops_in_object.js
Created June 6, 2021 23:04
How to deal with key value pairs in JavaScript object
const test = {a: 1, b: 2, c: 3};
// #1 ES6
for (const [key, value] of Object.entries(test)) {
console.log(key, value);
}
// #2
for (var k in test){
if (test.hasOwnProperty(k)) {
@vuongtran
vuongtran / count_duplicate.js
Last active June 6, 2021 22:57
How to count duplicate value in an array in javascript
// #1 Solution
var arr = ['a','b','c','d','d','e','a','b','c','f','g','h','h','h','e','a'];
var map = arr.reduce(function(prev, cur) {
prev[cur] = (prev[cur] || 0) + 1;
return prev;
}, {});
// map is an associative array mapping the elements to their frequency:
document.write(JSON.stringify(map));
// prints {"a": 3, "b": 2, "c": 2, "d": 2, "e": 2, "f": 1, "g": 1, "h": 3}
@vuongtran
vuongtran / gist:767ca14cd78cd10b45de9e291e27924a
Last active September 8, 2020 04:13
Open source eCommerce plaform with morden tech stack
# Plaforms
Shopware - https://github.com/shopware
Saleor - https://github.com/mirumee
Spree - https://github.com/spree
GetCandy - https://github.com/getcandy
Reaction Commerce - https://github.com/reactioncommerce
Vendure - https://github.com/vendure-ecommerce
# Storefront for eCommerce
Vue Storefront - PWA for eCommerce - https://www.vuestorefront.io
@vuongtran
vuongtran / react-handle-event-resize
Created May 14, 2018 16:01
React handle event window resize
import React, { Component } from 'react';
export default class RenderProducts extends Component {
constructor(props) {
super(props);
this.state = {
innerWidth: window.innerWidth,
}
this.handleResize = this.handelResize.bind(this);
}
handleResize(){
@vuongtran
vuongtran / repos_awesome.txt
Last active December 15, 2017 03:26
JavaScript Nodejs React Redux... repos awesome to use
The one-liner node.js http-proxy middleware for connect, express and browser-sync
https://github.com/chimurai/http-proxy-middleware
@vuongtran
vuongtran / nodejs .gitignore sample
Created June 6, 2017 05:22
Just a nodejs .gitignore sample to get start
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
@vuongtran
vuongtran / boom-get-request.js
Last active September 9, 2015 03:32
boom-get-request
// $.get(url)
// .done(function(response) {
// if (response.status === 'success') {
// // draw chart line now
// //fnDrawChartPieAndBar(option);
// } else {
// console.log(response.message);
// }
// }).fail(function(error) {
// console.log(error);
@vuongtran
vuongtran / uuid.js
Created July 26, 2015 23:26
Create UUID
// Code based on RFC 4122, section 4.4 (Algorithms for Creating a UUID from Truly Random or Pseudo-Random Number).
// http://www.ietf.org/rfc/rfc4122.txt
function createUUID() {
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
@vuongtran
vuongtran / transferring-money.feature
Created July 6, 2015 02:52
Example scenario using in BDD
Scenario: Transferring money from current account to saving account
Given I have a current accout with 1000
And I have a saving account with 2000
When I transfer 500 from my current account to my savings account
Then I should have 500 in my current account
And I should have 2500 in my saving account