Skip to content

Instantly share code, notes, and snippets.

View vanduc1102's full-sized avatar
πŸ›
πŸ’― πŸ’― πŸ’© πŸ˜† 🐒

Duke Nguyen vanduc1102

πŸ›
πŸ’― πŸ’― πŸ’© πŸ˜† 🐒
View GitHub Profile
# track this file .gitignore (i.e. do NOT ignore it)
!.gitignore
# ignore compiled / system files
*.com
*.class
*.dll
*.exe
*.o
*.so
setInterval(() => {document.querySelector(".invitation-card__action-btn").click()} , 3000);
@vanduc1102
vanduc1102 / .htaccess
Created June 18, 2020 13:53
PHP .htaccess environment variables
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
@vanduc1102
vanduc1102 / functions.php
Last active June 8, 2020 10:34
ampforwp add component script, e.g: amp-accordion
<?php
function prefix_add_amp_component_script( $data ) {
$data['amp_component_scripts']['amp-accordion'] = 'https://cdn.ampproject.org/v0/amp-accordion-0.1.js';
return $data;
}
add_filter( 'amp_post_template_data', 'prefix_add_amp_component_script' );
@vanduc1102
vanduc1102 / remove-dota.sh
Last active June 2, 2020 10:03
MacOS Remove Dota2 completely, Quit your Dota2 and Steam
rm -rf /Applications/Steam.app ~/Library/Application\ Support/Steam/
@vanduc1102
vanduc1102 / apache2.config
Last active June 30, 2020 06:51
Setup apache2 virtual hosts
SetEnv DB_USER root
SetEnv DB_PASSWORD test
SetEnv DB_HOST db
###### All content of apache2.config
Listen 7001
<VirtualHost *:7001>
DocumentRoot /var/www/html/api.local
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
@vanduc1102
vanduc1102 / add-common-varibale.bash
Last active April 4, 2020 16:44
convert file twit to php bash
#!/bin/bash
for file in *.twig;
do
output="${file//-/_}" # convert all - to _
output="${output/.twig/_php_output_array}" # convert .twig to _php_output_array
init_output="<?php\n\n\$${output} = array();\n/** \n"
return_output="\n*/\nreturn \$${output};"
file_content=$(cat $file)
echo "${init_output}\n$file_content\n${return_output}" > "$file";
@vanduc1102
vanduc1102 / sonar.sh
Created March 18, 2020 04:46
SonarQube command sample
sonar-scanner \
-Dsonar.projectKey=sample-project \
-Dsonar.sources=. \
-Dsonar.exclusions=vendor/**/* \
-Dsonar.host.url=https://localhost:9000 \
-Dsonar.login=keeeeeey
@vanduc1102
vanduc1102 / phpunit.xml
Created March 15, 2020 16:23
PHP Unit Code Coverage Setup phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./tests/TestHelper.php"
backupGlobals="false"
backupStaticAttributes="false"
verbose="true"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
@vanduc1102
vanduc1102 / deployment.sh
Created January 15, 2020 12:37
checkout code and reload nodejs server
#!/bin/sh
# It is good practice to print the required versions on server.
# cause the code will execute in SSH non interactively mode.
# https://stackoverflow.com/questions/17089808/how-to-do-remote-ssh-non-interactively
echo "NodeJS: "$(node -v)
echo "NPM: "$(npm -v)