Skip to content

Instantly share code, notes, and snippets.

View yeungon's full-sized avatar
💭
In JavaScript we trust

Vuong Nguyen yeungon

💭
In JavaScript we trust
View GitHub Profile
@yeungon
yeungon / background.js
Created January 15, 2021 14:31 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@yeungon
yeungon / index.html
Created December 20, 2020 12:59 — forked from sk8terboi87/index.html
JavaScript Web Worker Example: Fetching Random Content from Wikipedia using Web Workers. http://codelikeapoem.com/2017/03/web-workers-beginners-guide.html
<!DOCTYPE html>
<html>
<head>
<title>Polling Example</title>
<style type="text/css">
.title, .result {
display: inline-block;
padding: 10px;
background-color: #fffeee;
}
@yeungon
yeungon / introrx.md
Created July 4, 2020 09:54 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@yeungon
yeungon / media-query.css
Created January 1, 2020 17:12 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@yeungon
yeungon / install.sh
Created September 24, 2019 10:37 — forked from planetoftheweb/install.sh
installation for Vue and Firebase single
npm i --save-dev @fortawesome/fontawesome-free @fortawesome/fontawesome-svg-core @fortawesome/free-solid-svg-icons @fortawesome/vue-fontawesome bootstrap jquery popper.js firebase vuefire
@yeungon
yeungon / collect_form_data.js
Created June 5, 2019 03:44 — forked from everdimension/collect_form_data.js
A way to collect form data without `FormData` api.
handleSubmit(event) {
const form = event.target;
const data = {}
for (let element of form.elements) {
if (element.tagName === 'BUTTON') { continue; }
data[element.name] = element.value;
}
}
@yeungon
yeungon / README.md
Created January 30, 2018 14:27 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed


@yeungon
yeungon / .htaccess
Created January 9, 2018 02:08 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@yeungon
yeungon / vultr-snapshot.md
Created December 6, 2017 10:08
Automatic snapshots using Vultr API

Automated Snapshots / Backups via Vultr API

A more customizable alternative to Vultr's backup feature using Vultr API v1. Tested on Ubuntu 16.04. Run this php script on a Vultr instance to create a snapshot of itself and rotate out the oldest snapshot(s). Use the $backup_tag field to uniquely id a set of snapshots.

  1. Set $api_key to your Vultr API key.
  2. Set $num_of_backups to specify how many snapshots to keep.
  3. Set chmod +x vultr-snapshot.php.
  4. Add vultr-snapshot.php to your cron tab.
  5. Epic winning at life.
@yeungon
yeungon / gist:b9f92b1618560ea6130b6c360541bab8
Created August 1, 2017 14:20 — forked from marcgg/gist:733592
Regex to get the Facebook Page ID from a given URL
# Matches patterns such as:
# https://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/#!/my_page_id => my_page_id
# http://www.facebook.com/pages/Paris-France/Vanity-Url/123456?v=app_555 => 123456
# http://www.facebook.com/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/#!/page_with_1_number => page_with_1_number
# http://www.facebook.com/bounce_page#!/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/bounce_page#!/my_page_id?v=app_166292090072334 => my_page_id
# http://www.facebook.com/my.page.is.great => my.page.is.great