Skip to content

Instantly share code, notes, and snippets.

Avatar

Diep Nguyen BonsoirDiep

  • BaDa Tech
  • Danang, Vietnam
View GitHub Profile
View Puppeteer test 1
const puppeteer = require('puppeteer');
var database = {};
var fs = require('fs');
var cheerio = require('cheerio');
/* utils */
function save(path, data){
var xx = require('path').join(__dirname, path);
fs.writeFileSync(xx, JSON.stringify(data));
@BonsoirDiep
BonsoirDiep / AND_OR_NOT
Created May 5, 2018 — forked from oliverdoetsch/AND_OR_NOT
Blogger: Globally conditional data tags for all page types
View AND_OR_NOT
#AND
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<!--search_page AND index_page-->
</b:if>
</b:if>
#OR
@BonsoirDiep
BonsoirDiep / index.js
Last active Apr 2, 2018
Easy Facebook Conversations without Webhook : /graph.facebook.com/v2.12 [step by step]
View index.js
var request = require('request');
var express = require('express');
var app = express();
var session = require('express-session');
var FB_PAGE_ID = '<FB_PAGE_ID>';
var sess = {
secret: 'keyboard cat',
cookie: {},
resave: true,
@BonsoirDiep
BonsoirDiep / xoaDauTiengViet.js
Created Feb 2, 2018
Xóa dấu tiếng việt
View xoaDauTiengViet.js
/* @flow */
const defaultDiacriticsRemovalMap = [{
'base': 'A',
'letters': '\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F'
}, {
'base': 'AA',
'letters': '\uA732'
}, {
'base': 'AE',
@BonsoirDiep
BonsoirDiep / ConvertVie.js
Created Feb 2, 2018 — forked from hu2di/ConvertVie.js
JavaScript: Chuyển tiếng Việt có dấu sang không dấu
View ConvertVie.js
function change_alias(alias) {
var str = alias;
str = str.toLowerCase();
str = str.replace(|á|||ã|â||||||ă|||||ẵ/g,"a");
str = str.replace(|é||||ê||ế|||ễ/g,"e");
str = str.replace(|í|||ĩ/g,"i");
str = str.replace(|ó|||õ|ô||||||ơ|||||ỡ/g,"o");
str = str.replace(|ú|||ũ|ư|||||ữ/g,"u");
str = str.replace(/ỳ|ý|||ỹ/g,"y");
str = str.replace(/đ/g,"d");