Skip to content

Instantly share code, notes, and snippets.

laocoi / config.js
Created December 27, 2019 02:59 — forked from codediodeio/config.js
Snippets from the Firestore Data Modeling Course
View config.js
import * as firebase from 'firebase/app';
import 'firebase/firestore';
var firebaseConfig = {
// your firebase credentials
// Initialize Firebase
laocoi / vietnamese-slug.js
Last active June 11, 2022 03:06
Create Vietnamese slug from string - Javascript
View vietnamese-slug.js
function slugify(string){
const a = 'àáäâãåăæąçćčđďèéěėëêęğǵḧìíïîįłḿǹńňñòóöôœøṕŕřßşśšșťțùúüûǘůűūųẃẍÿýźžż·/_,:;'
const b = 'aaaaaaaaacccddeeeeeeegghiiiiilmnnnnooooooprrsssssttuuuuuuuuuwxyyzzz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/á|à|ả|ạ|ã|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ/gi, 'a')
.replace(/é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ/gi, 'e')
.replace(/i|í|ì|ỉ|ĩ|ị/gi, 'i')
.replace(/ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ/gi, 'o')
.replace(/ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự/gi, 'u')
laocoi / svg-viewer.php
Created May 27, 2019 10:57 — forked from AlekVolsk/svg-viewer.php
SVG viewer
View svg-viewer.php
$list = [];
$err = '';
$path = filter_input( INPUT_GET, 'path');
if ( !$path )
$err = 'Path is empty';
laocoi / PHP enable CORS
Created April 22, 2019 09:51
The following snippet should give you a quick overview about the required HTTP headers to set for CORS to work.
View PHP enable CORS
$allowedOrigins = array(
if (isset($_SERVER['HTTP_ORIGIN']) && $_SERVER['HTTP_ORIGIN'] != '') {
foreach ($allowedOrigins as $allowedOrigin) {
if (preg_match('#' . $allowedOrigin . '#', $_SERVER['HTTP_ORIGIN'])) {
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Max-Age: 1000');
laocoi / remove-words.php
Created December 14, 2018 08:47 — forked from keithmorris/remove-words.php
PHP remove common words from a string
View remove-words.php
function removeCommonWords($input){
// EEEEEEK Stop words
$commonWords = array('a','able','about','above','abroad','according','accordingly','across','actually','adj','after','afterwards','again','against','ago','ahead','ain\'t','all','allow','allows','almost','alone','along','alongside','already','also','although','always','am','amid','amidst','among','amongst','an','and','another','any','anybody','anyhow','anyone','anything','anyway','anyways','anywhere','apart','appear','appreciate','appropriate','are','aren\'t','around','as','a\'s','aside','ask','asking','associated','at','available','away','awfully','b','back','backward','backwards','be','became','because','become','becomes','becoming','been','before','beforehand','begin','behind','being','believe','below','beside','besides','best','better','between','beyond','both','brief','but','by','c','came','can','cannot','cant','can\'t','caption','cause','causes','certain','certainly','changes','clearly','c\'mon','co','co.','com','come','comes','concerni
laocoi / nginx.conf
Created September 2, 2018 17:09 — forked from jrom/nginx.conf
nginx hack for multiple conditions
View nginx.conf
if ($request_uri = /) {
set $test A;
if ($host ~* {
set $test "${test}B";
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
View Tăng size volume

Kiểm tra dung lượng hiện tại

df -h -x tmpfs -x devtmpfs

Tăng trong dashboard

Cập nhật

laocoi / Compile FFmpeg on CentOS - RHEL
Created June 28, 2018 14:29
This guide is in view of an insignificant establishment of the most recent CentOS discharge, and will provide a local, non-framework establishment of FFmpeg with support for a few outside encoding libraries.
View Compile FFmpeg on CentOS - RHEL

In your home directory make a new directory to put all of the source code into:

yum install autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
git clone --depth 1 git://
cd yasm
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
View Auto add nofollow to link -
View gist:a346a13b6d2e1ec33cb0b32652e8d1a6
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software