Skip to content

Instantly share code, notes, and snippets.

View hta218's full-sized avatar
🇻🇳
Working @ [::1]:443

Tuan Anh (Leo) Huynh hta218

🇻🇳
Working @ [::1]:443
View GitHub Profile
@hta218
hta218 / deep-merge.js
Created December 13, 2022 01:15 — forked from ahtcx/deep-merge.js
Deep-Merge JavaScript objects with ES6
// ⚠ IMPORTANT: this is old and doesn't work for many different edge cases but I'll keep it as-is for any of you want it
// ⚠ IMPORTANT: you can find more robust versions in the comments or use a library implementation such as lodash's `merge`
// Merge a `source` object to a `target` recursively
const merge = (target, source) => {
// Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties
for (const key of Object.keys(source)) {
if (source[key] instanceof Object) Object.assign(source[key], merge(target[key], source[key]))
}
@hta218
hta218 / git-clearHistory
Created June 7, 2021 15:25 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@hta218
hta218 / pagefly-atc-shopify.js
Last active April 17, 2020 03:41 — forked from paul-phan/pagefly-atc-shopify.js
pagefly-atc-shopify.js
////////////////////////////////////////////////// Basic template
// PageFly ATC Helpers - Do not delete
try {
window.addEventListener('load', function() {
window.__pagefly_helper_store__ && window.__pagefly_helper_store__.subscribe(function(res) {
// Handle update cart here
});
});
} catch(e) { console.error("PF Error:: ", e) }