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 / .prettierrc
Created April 15, 2019 03:20
Prettier PHP
{
"printWidth": 100,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"trailingComma": "none",
"braceStyle": "psr-2",
"requirePragma": false,
"insertPragma": false
}
@trungpv1601
trungpv1601 / ns_restlet_2x.js
Created May 9, 2019 08:14
Netsuite Restlet sample
/**
*@NApiVersion 2.x
*@NScriptType Restlet
*/
define(
[
'N/search',
'N/record',
'N/cache',
'N/format'
@trungpv1601
trungpv1601 / ns_sample_client_script_2x.js
Created May 10, 2019 07:36
Netsuite Sample Client Script 2.0
define([], function() {
/**
* Sample Client Script
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType ClientScript
*/
/* === VARS === */
@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
@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 / 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 / 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.

{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"A File Icon",
"Alignment",
"All Autocomplete",
@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,
@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++;