Skip to content

Instantly share code, notes, and snippets.

@saosangmo
saosangmo / ConvertVie.js
Created June 5, 2022 19:21 — forked from hu2di/ConvertVie.js
JavaScript: Chuyển tiếng Việt có dấu sang không dấu
function removeVietnameseTones(str) {
str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,"a");
str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,"e");
str = str.replace(/ì|í|ị|ỉ|ĩ/g,"i");
str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,"o");
str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,"u");
str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g,"y");
str = str.replace(/đ/g,"d");
str = str.replace(/À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ/g, "A");
str = str.replace(/È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ/g, "E");
@saosangmo
saosangmo / purge_cf.php
Created December 30, 2021 20:36 — forked from Greg-Boggs/purge_cf.php
PHP code to Purge Cloudflare Cache
<?php
// Replace EMAIL/API_KEY/ZONE_ID with your details.
// Zone ID is on the dashboard for the domain in the bottom right.
// Api keys are generated from the account settings. You must give cache purge permissions
// Place this script on your webserver and point a Github Webhook at it, and you'll clear
// the Cloudflare cache every time you do a push to GH.
try {
$head = [];
$head[] = 'Content-Type: application/json';
//php
if(isset($_FILES["upload"])){
$ext = ".".end((explode(".", $_FILES["upload"]["name"])));
$filename="test";
$file_public_addr =yourlocaladdr.$filename.$ext;
$success=move_uploaded_file($_FILES["upload"]["tmp_name"],SYS_EXT.$file_public_addr);
if( $success){
$json["uploaded"]=true;
@saosangmo
saosangmo / install-LEMP-on-ubuntu-20.04-minimal.md
Last active December 23, 2021 11:10 — forked from nd3w/install-nginx-mariadb-phpfpm-on-ubuntu-20.04.md
Install LEMP on Ubuntu 20.04 with Let Encrypts

How to Install Nginx, MariaDB, PHP-FPM on Ubuntu 20.04 Minimal

This is a way to install and set up Nginx, MariaDB and PHP 8.1 (mode PHP-FPM), Certbot on Ubuntu 20.04.

$ sudo apt update

Nginx

$ sudo apt install nginx -y
/**
* Summernote StripTags
*
* This is a plugin for Summernote (www.summernote.org) WYSIWYG editor.
* To strip unwanted HTML tags and attributes while pasting content in editor.
*
* @author Hitesh Aggarwal, Extenzine
*
*/
@saosangmo
saosangmo / 186_backlink_google_search
Created March 18, 2021 10:06
Cách kiếm 186 backlink xịn từ Google
@saosangmo
saosangmo / nginx.conf
Created February 10, 2020 16:11 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@saosangmo
saosangmo / create_php_site.sh
Created January 30, 2020 14:54 — forked from allebb/create_php_site.sh
Nginx and PHP-FPM, bash script for creating new vhost’s under separate fpm pools
#!/bin/bash
# @author: Seb Dangerfield
# http://www.sebdangerfield.me.uk/?p=513
# Created: 11/08/2011
# Modified: 07/01/2012
# Modified: 17/05/2012
# Modify the following to match your system
NGINX_CONFIG='/etc/nginx/sites-available'
NGINX_SITES_ENABLED='/etc/nginx/sites-enabled'
<script type="application/ld+json">
{ "@context": "https://schema.org",
"@type": "Organization",
"name": "Elite Strategies",
"legalName" : "Elite Strategies Llc",
"url": "http://www.elite-strategies.com",
"logo": "http://cdn.elite-strategies.com/wp-content/uploads/2013/04/elitestrategies.png",
"foundingDate": "2009",
"founders": [
{
@saosangmo
saosangmo / popup.html
Created April 5, 2019 18:24 — forked from Moollihawkja/popup.html
Creating a pop up in pure javascript
<!DOCTYPE html>
<html>
<head>
<style>
.popup {
position: fixed;
top: 50vh;
left: 50%;
width:400px;
margin-left: -200px;