Skip to content

Instantly share code, notes, and snippets.

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

Hung Nguyen nthung2112

🏠
Working from home
View GitHub Profile
@nthung2112
nthung2112 / countCSSRules.js
Created September 10, 2016 07:50 — forked from psebborn/countCSSRules.js
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
#EXTM3U
#EXTINF:-1,VTV1 HD
http://live.cdn.mobifonetv.vn/motv3/vtv1hd_hls.smil/chunklist_b1200000.m3u8
#EXTINF:-1,VTV2 HD
http://live.cdn.mobifonetv.vn/motv3/vtv2hd_hls.smil/chunklist_b1200000.m3u8
#EXTINF:-1,VTV3 HD
http://118.107.85.14:1935/tvnet/smil:vtv3.smil/chunklist_w246683264_b1000000.m3u8
#EXTINF:-1,VTV4 HD
http://live.cdn.mobifonetv.vn/motv/vtv4_hls.smil/chunklist_b1200000.m3u8
window.addEventListener("load", function(event) {
var videoElm = $("#movie_player").find('video')[0];
addButtonReplay(videoElm);
$(videoElm).on('play', function(e) {
addButtonReplay(videoElm);
});
});
function addButtonReplay(videoElm) {
var buttonReplay = $('<button type="button" style="background-color: #4285F4;color: white;height:24px;padding: 0 5px;border-radius:4px;cursor:pointer;outline:none;">Replay</button>');
@nthung2112
nthung2112 / destructuring.js
Created August 5, 2017 09:18 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@nthung2112
nthung2112 / epg.xml
Last active October 30, 2020 05:10
Update new content
<?xml version="1.0"?>
<tv updated="Fri Oct 30 2020 12:10:53 GMT+0700 (+07)" author="nthung2112">
<channel id="beinsports1">
<display-name>beIN Sports 1</display-name>
<display-name>beIN Sports 1 HD</display-name>
<display-name>beIN Sports 1 4K</display-name>
</channel>
<channel id="beinsports10">
<display-name>beIN Sports 10</display-name>
<display-name>beIN Sports 10 HD</display-name>
@nthung2112
nthung2112 / asyncloops.js
Created January 1, 2018 10:26 — forked from lukehoban/asyncloops.js
Async/await and parallel loops
// ES6 w/ Promises
// Note: From a React starter template - see https://t.co/wkStq8y3I5
function fetchData(routes, params) {
let data = {};
return Promise.all(routes
.filter(route => route.handler.fetchData)
.map(route => {
return route.handler.fetchData(params).then(resp => {
data[route.name] = resp;
// Show logs branchs with info
git for-each-ref --sort=-authordate:iso8601 --format=%(authordate:relative)%09%(refname:short) refs/heads
git for-each-ref --sort=-committerdate --format=%(refname)%09%(committerdate) refs/remotes
git for-each-ref --format=%(committerdate)%09%(authorname)%09%(refname) refs/heads
@nthung2112
nthung2112 / Parser_m3u_simple.js
Created March 1, 2018 02:02
Parse file m3u simple
const SUPPORT_TYPE = ['http', 'udp', 'rtp'];
function getStringBetween(str, start, end) {
const startIndex = str.indexOf(start);
if (startIndex === -1)
return '';
const res = str.slice(startIndex + start.length);
if (typeof end === 'undefined') {
@nthung2112
nthung2112 / Convert-logos.js
Last active March 4, 2018 01:12
Convert m3u link logo to imgur
var axios = require('axios');
var fs = require('fs');
var parser = require('./parser.js');
var list = fs.readFileSync('./list.m3u');
var result = list.toString();
var links = [];
function uploadImage({ logo, name }) {
return new Promise(async (resolve, reject) => {
try {