Skip to content

Instantly share code, notes, and snippets.

View trungx's full-sized avatar
🚩
Go to 2022

trungx

🚩
Go to 2022
View GitHub Profile
@trungx
trungx / Install php-cs-fixcer on windows.md
Created March 24, 2020 10:18
Install php-cs-fixcer on windows.md

Install php-cs-fixer on windows

Requirements

PHP needs to be a minimum version of PHP 5.3.6.
You need install php and composer in global (add php excutable file to environment var)
Recheck: open cmd => php -v

Install Globally (Composer)

./composer.phar global update friendsofphp/php-cs-fixer

reference: https://github.com/FriendsOfPHP/PHP-CS-Fixer

@trungx
trungx / CodeRude.md
Last active March 20, 2020 10:22
Coding Style Guide
@trungx
trungx / clear-credential-manager.cmd
Created February 18, 2020 08:48 — forked from tomfanning/clear-credential-manager.cmd
Batch file to clear all credentials from Windows Credential Manager
@echo off
cmdkey.exe /list > "%TEMP%\List.txt"
findstr.exe Target "%TEMP%\List.txt" > "%TEMP%\tokensonly.txt"
FOR /F "tokens=1,2 delims= " %%G IN (%TEMP%\tokensonly.txt) DO cmdkey.exe /delete:%%H
del "%TEMP%\List.txt" /s /f /q
del "%TEMP%\tokensonly.txt" /s /f /q
echo All done
pause
@trungx
trungx / nginxproxy.md
Created December 17, 2019 04:19 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

Beginner: Linked List, Stack, Queue, Binary Search Tree.
Intermediate: Heap, Priority Queue, Huffman Tree, Union Find, Tries, Hash Table, Tree Map.
Proficient: Segment Tree, Binary Indexed Tree, Suffix Array, Sparse Table, Lowest Common Ancestor, Range Tree.
Expert: Suffix Automaton, Suffix Tree, Heavy-Light Decomposition, Treap, Aho-Corasick, K-d tree, Link-Cut Tree, Splay Tree, Palindromic Tree, Rope, Dancing Links, Radix Tree, Dynamic Suffix Array.
@trungx
trungx / reset.css
Created October 25, 2019 07:19
reset to default css
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@trungx
trungx / Array.sum().js
Created September 6, 2019 11:04
Array.sum().js
// const AwaitAsyncForEach = require('await-async-foreach');
// const _ = require('lodash');
// const Delay = async (delay) => {
// return new Promise((resolve, reject) => {
// setTimeout(() => {
// resolve();
// }, delay);
// });
@trungx
trungx / adblock_prevent.js
Created August 28, 2019 02:25
adblock_prevent.js
document.addEventListener('DOMContentLoaded', init, false);
function init(){
adsBlocked(function(blocked){
if(blocked){
document.getElementById('result').innerHTML = 'ads are blocked';
} else {
document.getElementById('result').innerHTML = 'ads are not blocked';
}
})
@trungx
trungx / object_to_array.php
Created August 27, 2019 16:34
Recursive convert object to array
<?php
/* Recursive convert object to array
*
*
* @param object $variable
* @return converted array $variable
*/
function object_to_array($d) {
if (is_object($d))
$d = get_object_vars($d);
<!DOCTYPE html>
<html>
<head>
<title>Google Fonts Preview</title>
<style>
#preview {
margin: 0 auto;
text-align: center;
width: 80%;
}