Skip to content

Instantly share code, notes, and snippets.

@nguyenhuucam91
nguyenhuucam91 / docker-compose.yml
Last active May 9, 2020 09:50
Cấu hình Docker-compose yml chạy Nginx / Php / Mysql / Redis
version: '2'
services:
web:
container_name: docker-nginx-latest
image: nginx:latest
restart: always
ports:
- "80:80"
volumes:
- ./code:/var/www
@rnjailamba
rnjailamba / solrMysqlSetup.md
Last active March 16, 2024 14:10
Solr + Mysql + Data Import Handler + Delta Import Handler [ Version 5.5.0 of solr ]
@hollodotme
hollodotme / convert_databases_utf8.php
Last active April 8, 2024 23:13
Converting mysql string data form latin1 to utf8 for utf8 data stored in utf8 tables via latin1 connection
<?php
/**
* Requires php >= 5.5
*
* Use this script to convert utf-8 data in utf-8 mysql tables stored via latin1 connection
* This is a PHP port from: https://gist.github.com/njvack/6113127
*
* @link : http://www.ridesidecar.com/2013/07/30/of-databases-and-character-encodings/
*
* BACKUP YOUR DATABASE BEFORE YOU RUN THIS SCRIPT!
@ryanmerritt
ryanmerritt / gist:3742433
Created September 18, 2012 10:17
Verify a date string is ISO 8601 formatted in PHP
// Regex from http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
function assertISO8601Date($dateStr) {
if (preg_match('/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/', $dateStr) > 0) {
return TRUE;
} else {
return FALSE;
}
}
@akhy
akhy / FTPuploader.php
Created June 24, 2012 10:38
PHP FTP Upload with Recursive Mkdir
<?php
/* PHP class for uploading file via FTP wich automatically make non-exist directory recursively */
<?php
class FTPUploader {
private static function make_directory($ftp_stream, $dir)
{
// if directory already exists or can be immediately created return true
if (FTPUploader::ftp_is_dir($ftp_stream, $dir) || @ftp_mkdir($ftp_stream, $dir)) return true;