Skip to content

Instantly share code, notes, and snippets.

View congdinh's full-sized avatar
🤠
Always learning

Neo congdinh

🤠
Always learning
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<meta name="viewport">
<body>
<!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
<div id="player"></div>
error: Error while preview weekly report
error: AssertionError: html-pdf: Failed to load PhantomJS module. You have to set the path to the PhantomJS binary using 'options.phantomPath'
at new PDF (/home/eastdata/codes/cms/node_modules/html-pdf/lib/pdf.js:38:3)
at Object.createPdf [as create] (/home/eastdata/codes/cms/node_modules/html-pdf/lib/index.js:10:14)
at /home/eastdata/codes/cms/api/controllers/WeeklyReportController.js:1176:21
at wrapped (/home/eastdata/codes/cms/node_modules/newrelic/lib/transaction/tracer/index.js:183:28)
at Promise.linkTransaction (/home/eastdata/codes/cms/node_modules/newrelic/lib/instrumentation/promise.js:273:65)
at Promise.wrapped (/home/eastdata/codes/cms/node_modules/newrelic/lib/transaction/tracer/index.js:183:28)
at Promise.proxyWrapper (/home/eastdata/codes/cms/node_modules/newrelic/lib/instrumentation/promise.js:284:23)
var express = require('express');
var router = express.Router();
var models = require('../server/models/index');
var passport = require('passport');
var authInfo = require('../config/auth');
var FacebookStrategy = require('passport-facebook').Strategy;
// used to serialize the user for the session
passport.serializeUser(function (user, done) {
import React from 'react';
import HighChart from './HighChart';
import { defaultHighchart } from 'config';
const optionsDefault = {
chart: {
plotBackgroundColor: null,
plotBorderWidth: 0,
plotShadow: false,
style: {
[{"_id":"58d1eecdea5f877e43a6afb9","name":"mShield","check":1,"labels":[],"__typename":"Label"},{"_id":"58d230e0ea5f877e43a6b4b4","name":"Thương hiệu","check":1,"labels":[{"_id":"58d2318aea5f877e43a6b4c6","name":"Hoạt động kinh doanh","check":1,"__typename":"Label"},{"_id":"58d231b2ea5f877e43a6b4ca","name":"Ban lãnh đạo","check":1,"__typename":"Label"},{"_id":"58d231cfea5f877e43a6b4ce","name":"Hoạt động xã hội","check":1,"__typename":"Label"}],"__typename":"Label"},{"_id":"58d230efea5f877e43a6b4b6","name":"Chiến dịch truyền thông","check":1,"labels":[{"_id":"58d230e8ea5f877e43a6b4b5","name":"Hoạt động trên fanpage","check":1,"__typename":"Label"},{"_id":"58d23157ea5f877e43a6b4c1","name":"Khuyến mãi","check":1,"__typename":"Label"},{"_id":"58d231bfea5f877e43a6b4cc","name":"Quảng cáo","check":1,"__typename":"Label"},{"_id":"58d231c5ea5f877e43a6b4cd","name":"Sự kiện","check":1,"__typename":"Label"},{"_id":"58e76a389ce313be0eb8c966","name":"Được sử dụng làm quà tặng","check":1,"__typename":"Label"}],"__typename":
import React from 'react';
import { sentiments } from "config";
import { percentage } from 'utils/index';
import './ParentChildLabelBySentimentBar.css';
import { labelFilter } from './filterLabels.js';
export default (props) => {
if (!props.data) {
return <span>No data</span>;
}
@congdinh
congdinh / sets.js
Created February 27, 2018 09:47 — forked from clohr/sets.js
ES6 Sets: Intersection, Difference, and Union
const a = new Set([1, 2, 3, 4, 4, 4])
const b = new Set([3, 4, 5, 6])
const intersect = (set1, set2) => [...set1].filter(num => set2.has(num))
const differ = (set1, set2) => [...set1].filter(num => !set2.has(num))
const joinSet = (set1, set2) => [...set1, ...set2]
const myIntersectedSet = new Set(intersect(a, b))
console.log('myIntersectedSet', myIntersectedSet)
const removeDiacritics = (str) => {
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");
str = str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'|\"|\&|\#|\[|\]|~|\$|_|`|-|{|}|\||\\/g, " ");
@congdinh
congdinh / setting-vscode-format
Last active January 2, 2019 12:38
File > Preferences > Settings > Tab User Settings
{
"window.zoomLevel": 0,
"editor.renderControlCharacters": true,
"workbench.activityBar.visible": true,
"editor.renderWhitespace": "all",
"diffEditor.ignoreTrimWhitespace": false,
"editor.wordWrap": "on",
// Controls if quick suggestions should show up while typing
"editor.quickSuggestions": true,
// Controls if suggestions should be accepted with "Enter" - in addition to "Tab". Helps to avoid ambiguity between inserting new lines and accepting suggestions.
@congdinh
congdinh / javascript.json
Last active May 11, 2020 07:59
User snippets Setting Vscode: preferences > Users snippets
{
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",