Skip to content

Instantly share code, notes, and snippets.

View vanquyet94's full-sized avatar

Nguyễn Văn Quyết vanquyet94

View GitHub Profile
@vanquyet94
vanquyet94 / README.md
Created May 6, 2023 13:43 — forked from abelcallejo/README.md
Installing GDAL 3.2.1 on Amazon Linux 2

Installing GDAL 3.2.1 on Amazon Linux 2

gdal linux yum

As of this day, this is probably the only and fastest way of installing it.

Package requirements

Based from the GDAL and PROJ build requirements, here is the full list of required packages to install:

@vanquyet94
vanquyet94 / cluster-worker-id.js
Created September 27, 2022 04:30 — forked from ando-takahiro/cluster-worker-id.js
what is cluster.worker.id?
var cluster = require('cluster');
if (cluster.isMaster) {
for (var i = 0; i < 4; ++i) {
cluster.fork();
}
} else {
console.log(process.pid, cluster.worker.id);
}
@vanquyet94
vanquyet94 / import.md
Created May 26, 2022 10:08 — forked from geraldvillorente/import.md
How to import database in MySQL in Docker?

This is a simple way of importing MySQL database in Docker.

  1. In you Dockerfile you must have a shared folder. Shared folder is a directory in your host machine that is mounted to Docker instance.

  2. Put the exported sql file in the shared folder.

  3. Login to your Docker instance via docker exec -it DOCKER_CONTAINER_ID bin/bash.

  4. Login to MySQL via mysql -u USERNAME -p.

/**
* Validates hex value
* @param {String} color hex color value
* @return {Boolean}
*/
function isValidHex(color) {
if(!color || typeof color !== 'string') return false;
// Validate hex values
if(color.substring(0, 1) === '#') color = color.substring(1);
@vanquyet94
vanquyet94 / MyDatabaseTokenRepository.php
Created August 31, 2021 05:12 — forked from JT501/MyDatabaseTokenRepository.php
Laravel Custom Reset Password Token
<?php
namespace App\Providers\Passwords;
use Illuminate\Auth\Passwords\DatabaseTokenRepository;
class MyDatabaseTokenRepository extends DatabaseTokenRepository
{
/**
* [Override]
@vanquyet94
vanquyet94 / log_uploads
Created July 14, 2021 17:10 — forked from richardW8k/log_uploads
Logs file uploads for single file and multi-file upload fields pre and post submission to the Gravity Forms logging add-on: http://www.gravityhelp.com/downloads/#Gravity_Forms_Logging_Tool
add_action( 'gform_pre_submission_8', 'uploads_log_pre_submission' );
function uploads_log_pre_submission( $form ) {
foreach ( $form["fields"] as &$field ) {
if ( $field["type"] == "fileupload" ) {
$id = "input_".$field["id"];
if ( $field["multipleFiles"] ) {
if ( empty( $_POST["gform_uploaded_files"] ) )
continue;
@vanquyet94
vanquyet94 / slugify.js
Created June 22, 2021 15:59 — forked from khushalbokadey/slugify.js
Code to slugify text. Mainly to use in google sheets.
function slugify(value) {
/*
* Convert the the vs in a range of cells into slugs.
*/
slug = '';
slug = value.substring(0, 30).toLowerCase();
slug = slug.replace(/[^\w\s-]/g, '');
slug = slug.replace(/\s+/g, '-');
Logger.log(slug);
@vanquyet94
vanquyet94 / README.md
Created June 22, 2021 15:51 — forked from onyxfish/README.md
Google Spreadsheets script to generate slugs from a range of cells

This script for Google Spreadsheets allows you to generate slugs for your data such as might be used for creating unique urls.

Use it like this!

# A B C
1 a b slug
2 foo baz bing =slugify(A2:B4)
3 bar BAZ
4 FOO baz-bing
@vanquyet94
vanquyet94 / UUID.php
Created May 25, 2021 03:33 — forked from dahnielson/UUID.php
Pure PHP UUID generator
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@vanquyet94
vanquyet94 / meta-tags.md
Created May 25, 2021 01:16 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">