Skip to content

Instantly share code, notes, and snippets.

laptrinhcomvn / wp-bootstrap5.0-pagination.php
Created January 18, 2022 19:59 — forked from mtx-z/wp-bootstrap5.0-pagination.php
Wordpress 5.7 Bootstrap 5.0 pagination (with custom WP_Query() and global $wp_query support)
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
* @return string|null
* Using Bootstrap 4? see
laptrinhcomvn /
Created July 7, 2020 17:29 — forked from willpatera/
Post to google spreadsheet from html form


This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey

Depreciation Warning: This code is not maintained, and should be seen as reference implementation only. If you're looking to add features or update, fork the code and update as needed.

Run example

You should be able to just open index.html in your browser and test locally.

laptrinhcomvn / my.cnf
Created May 18, 2020 19:11 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
# Optimized my.cnf configuration for MySQL/MariaSQL
# by Fotis Evangelou, developer of Engintron (
# ~ Updated January 2020 ~
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
Steps to recreate tests:
// Create and configure server:
1. Create 2GB DigitalOcean server using Forge
2. Enable OpCache on server
3. Create (use whatever domain name you have available)
4. Create (use whatever domain name you have available)
5. Enable SSL on both domains using LetsEncrypt
6. Install: sudo apt-get install apache2-utils
laptrinhcomvn / How to create VOD HLS
Last active October 18, 2019 17:16 — forked from mrbar42/
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)


bash beach.mkv

will produce:

      |- playlist.m3u8
 |- 360p.m3u8
laptrinhcomvn /
Created July 16, 2018 17:22 — forked from Gnzlt/
Android utils class to get a Bitmap from a VectorDrawable Resource Id (Took from
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
// API access key from Google API's Console; change to cloud messaging tab to get the server token
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
'body' => $_GET['body'],
'title' => $_GET['title'],
'vibrate' => 1,
laptrinhcomvn / Set up Ubuntu 16.04 server: Nginx + PHP 71 + MySQL + Composer
Last active July 21, 2019 07:14
Set up EC2 Ubuntu server: Nginx + PHP 71 + Composer 2017

1. Commons

Reset ssh know host for remote ip:

ssh-keygen -R hostname [-f known_hosts_file]

ssh to server, and run as root user using command,

sudo su
laptrinhcomvn /
Last active December 10, 2016 12:16 — forked from liamcurry/gist:2597326
Vanilla JS vs jQuery

Moving from jQuery to Vanilla


// jQuery
$(document).ready(function() {
  // code

// Vanilla
laptrinhcomvn /
Last active January 11, 2022 19:58
Set up on Mac OS X El Capitan: Nginx - PHP 5.6.x

Mac OS X El Capitan setup Nginx - PHP 5.6.x, MySQL 5.7.x, phpMyAdmin

1 Install homebrew

Run this command to install homebrew at system level

/usr/bin/ruby -e "$(curl -fsSL"