Skip to content

Instantly share code, notes, and snippets.

View trungpv1601's full-sized avatar
🤖
Diversifying; Practical; more code than talk.

trungpv trungpv1601

🤖
Diversifying; Practical; more code than talk.
View GitHub Profile
@trungpv1601
trungpv1601 / .eslintrc.json
Last active December 26, 2019 07:23
Config React + ESLINT + PRETTIER
{
"extends": [
"eslint:recommended",
"prettier",
"prettier/react",
"plugin:import/errors",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended"
],
"rules": {
@trungpv1601
trungpv1601 / README.MD
Created October 11, 2019 02:37
Setup new Wordpress site on ubuntu
  1. Setup Apache

sudo mkdir -p /var/www/xxx.com

sudo chown -R www-data: /var/www/xxx.com

/etc/apache2/sites-available/xxx.com.conf

@trungpv1601
trungpv1601 / README.MD
Created August 8, 2019 04:04
How to delete ALL node_modules folders on your machine and free up HD space!

List All

$ cd documents
$ find . -name "node_modules" -type d -prune | xargs du -chs

--- Example output ---
25M ./Github/Trilon.io/node_modules
482M ./Github/Some_Demo/node_modules

707M total
@trungpv1601
trungpv1601 / test.js
Created August 2, 2019 12:33
Filter JavaScript Objects with Fuzzy Search
// Thanks to https://bytemaster.io/filter-javascript-objects-fuzzy-search
Array.prototype.fuzzySearch = function (query) {
var search = query.split(' ');
var ret = this.reduce((found, i) => {
var matches = 0;
search.forEach(s => {
var props = 0;
for (var prop in i) {
if (i[prop].indexOf(s) > -1) {
props++;
@trungpv1601
trungpv1601 / settings.json
Last active August 5, 2019 02:35
VSCode settings.json
{
"workbench.iconTheme": "material-icon-theme",
"editor.fontSize": 15,
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.tabSize": 2,
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"A File Icon",
"Alignment",
"All Autocomplete",
@trungpv1601
trungpv1601 / README.md
Created July 10, 2019 06:03 — forked from leek/_Magento1_DeleteTestData.md
Magento 1 - Delete All Test Data

These set of scripts are for Magento 1. For Magento 2, see this Gist.

@trungpv1601
trungpv1601 / proxy.js
Last active May 31, 2019 00:41
Nodejs Web Proxy Default Port 1080
'use strict';
const http = require('http'),
net = require('net');
const config = {
port: process.env.port || 1193,
};
@trungpv1601
trungpv1601 / fcntl.py
Last active May 29, 2019 14:42
No module named 'fcntl'
def fcntl(fd, op, arg=0):
return 0
def ioctl(fd, op, arg=0, mutable_flag=True):
if mutable_flag:
return 0
else:
return ""
def flock(fd, op):
@trungpv1601
trungpv1601 / helppers.php
Created May 29, 2019 05:24
get string between or get string from to php
<?php
/**
* Get string between start => end
*
* @param $string
* @param $start
* @param $end
*
* @return string