Skip to content

Instantly share code, notes, and snippets.

@laptrinhcomvn
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)
View wp-bootstrap5.0-pagination.php
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* Using Bootstrap 4? see https://gist.github.com/mtx-z/f95af6cc6fb562eb1a1540ca715ed928
*
@laptrinhcomvn
laptrinhcomvn / Google-Sheet-Form-Post.md
Created July 7, 2020 17:29 — forked from willpatera/Google-Sheet-Form-Post.md
Post to google spreadsheet from html form
View Google-Sheet-Form-Post.md

Overview

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
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)
View my.cnf
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ 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.
#
View gist:3af7c0fd66c4a515348258e9ebdd3103
Steps to recreate tests:
// Create and configure server:
1. Create 2GB DigitalOcean server using Forge
2. Enable OpCache on server
3. Create http://domain1.com (use whatever domain name you have available)
4. Create http://domain2.com (use whatever domain name you have available)
5. Enable SSL on both domains using LetsEncrypt
6. Install: sudo apt-get install apache2-utils
@laptrinhcomvn
laptrinhcomvn / How to create VOD HLS Stream.md
Last active October 18, 2019 17:16 — forked from mrbar42/README.md
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)
View How to create VOD HLS Stream.md

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@laptrinhcomvn
laptrinhcomvn / ResourceUtil.java
Created July 16, 2018 17:22 — forked from Gnzlt/ResourceUtil.java
Android utils class to get a Bitmap from a VectorDrawable Resource Id (Took from http://qiita.com/konifar/items/aaff934edbf44e39b04a)
View ResourceUtil.java
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.VectorDrawable;
import android.os.Build;
import android.support.annotation.DrawableRes;
import android.support.graphics.drawable.VectorDrawableCompat;
View send-fcm-pushnotification.php
<?php
// API access key from Google API's Console; change to cloud messaging tab to get the server token
define( 'API_ACCESS_KEY', 'YOUR_FIREBASE_API_ACCESS_KEY' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
(
'body' => $_GET['body'],
'title' => $_GET['title'],
'vibrate' => 1,
@laptrinhcomvn
laptrinhcomvn / Set up Ubuntu 16.04 server: Nginx + PHP 71 + MySQL + Composer 2017.md
Last active July 21, 2019 07:14
Set up EC2 Ubuntu server: Nginx + PHP 71 + Composer 2017
View Set up Ubuntu 16.04 server: Nginx + PHP 71 + MySQL + Composer 2017.md

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
laptrinhcomvn / moving_from_jquery_to_vanilla.md
Last active December 10, 2016 12:16 — forked from liamcurry/gist:2597326
Vanilla JS vs jQuery
View moving_from_jquery_to_vanilla.md

Moving from jQuery to Vanilla

Events

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

// Vanilla
@laptrinhcomvn
laptrinhcomvn / nginx+php+mysql_osx.md
Last active January 11, 2022 19:58
Set up on Mac OS X El Capitan: Nginx - PHP 5.6.x
View nginx+php+mysql_osx.md

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 https://raw.githubusercontent.com/Homebrew/install/master/install)"