Skip to content

Instantly share code, notes, and snippets.

https://github.com/thanhson1085/bean-seed/
------------
// app.js
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
@vmdao
vmdao / webcrawler.js
Created March 10, 2017 14:00 — forked from amoilanen/webcrawler.js
Simple PhantomJS-based web crawler library
//PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov anton.al.ivanov@gmail.com 2012
//UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler"
//the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist
(function(host) {
function Crawler() {
this.visitedURLs = {};
};
@vmdao
vmdao / jsonp.js
Created August 25, 2017 05:00 — forked from gf3/jsonp.js
Simple JSONP in vanilla JS
/**
* loadJSONP( url, hollaback [, context] ) -> Null
* - url (String): URL to data resource.
* - hollaback (Function): Function to call when data is successfully loaded,
* it receives one argument: the data.
* - context (Object): Context to invoke the hollaback function in.
*
* Load external data through a JSONP interface.
*
* ### Examples
@vmdao
vmdao / README.md
Created August 26, 2017 10:59 — forked from brunogaspar/README.md
Install wkhtmltopdf on Ubuntu (14.04 64-bit) or (16.04 64-bit)

Install wkhtmltopdf on Ubuntu

This was tested on:

  • Ubuntu 14.04 x64
  • Ubuntu 16.04 x64

Installation

@vmdao
vmdao / wkhtmltopdf_wkhtmltoimage.md
Created August 27, 2017 06:04 — forked from isogram/wkhtmltopdf_wkhtmltoimage.md
How to manually install Wktohtmlpdf and Wkhtmltoimage in Ubuntu Server

How to Install Wkhtmltopdf and Wkhtmltoimage in Ubuntu

wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar -xvf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
cd wkhtmltox/bin/
sudo mv wkhtmltopdf  /usr/bin/wkhtmltopdf
sudo mv wkhtmltoimage  /usr/bin/wkhtmltoimage
@vmdao
vmdao / gist:37b60a5c4cebfa1692ebaba70885c6ee
Created January 4, 2018 02:57
Nginx config with container PHP
server {
listen 80;
listen [::]:80;
server_name domain.com;
return 301 https://$server_name;
}
server {

You can check here for getting the latest version. Change the wget url to download newer versions.

$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ cd wkhtmltox/bin/
$ sudo mv wkhtmltopdf /usr/bin/wkhtmltopdf
$ sudo mv wkhtmltoimage /usr/bin/wkhtmltoimage
$ sudo chmod a+x /usr/bin/wkhtmltopdf
@vmdao
vmdao / gist:74737670e41e0b58733ce50e8b87c2c5
Last active July 9, 2018 03:48
[CSS] The heigh automatically changes by the width

Create box width and Height ratio Thank Nghiep, go to link

<!--- code HTML -->
<div class="constant-width-to-height-ratio"></div>
# Code CSS
@vmdao
vmdao / redis_mysql_dump.js
Created July 9, 2018 13:22 — forked from m0llysour/redis_mysql_dump.js
Redis to MySQL dump
// modules
var redis = require('redis');
var Step = require('step');
// config file
var config = require('config');
// mysql client connect
var mysql = require('mysql');
var connection = mysql.createConnection({