Skip to content

Instantly share code, notes, and snippets.


JGWill jgwill

View GitHub Profile
# call this from ~/.bashrc
# like source ~/projects/Dockcommander/
alias d=docker
alias dcl='docker container ps -a'
alias dps=dcl
alias dcstats='docker stats'
alias dcs='docker stats'
alias dr='docker run'
alias drm='docker rm '
jgwill / vscode-white-space-config.json
Last active Oct 25, 2018
VSCode keeps removing the space you wrote, change to this config
View vscode-white-space-config.json
"editor.trimAutoWhitespace": false
jgwill / format-content-urls-as-html.php
Last active Oct 29, 2018
PHP parsing content to format URL to become clickable in HTML
View format-content-urls-as-html.php
foreach ($chatDatas as $chat)
//Expression capturing URL string
$urlXpression = '~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i';
//replacing in text URL with formatted HTML Linked Tag
$chatHTML = preg_replace($urlXpression, '<a href="$0" target="_blank" title="$0">$0</a>', $chat);
//display each chat element
echo "<tr><td>"
. $chatHTML["ChatLine"]
jgwill /
Last active Nov 3, 2018
@stcgoal Auto Restart a NodeJS Server When development files are changed, it restart the server.

Auto Restart a NodeJS Server

When development files are changed, it restart the server.

npm start

Ref & info

  • Package:NodeMon
  • sudo npm install nodemon -g
jgwill /
Last active Nov 6, 2018
node.js - Watch a folder and execute an action when that happen
//@a Watch a folder and do something with the changes
var watchPath = "/www/x/fs_watch_folder_1811051535/tests";
console.log("Watching test path: " + watchPath);
var fs = require("fs");
var sleep = require("sleep");, (eventType, filename) => {
// could be either 'rename' or 'change'. new file event and delete
jgwill / Fetch URL title - Node.js
Last active Nov 6, 2018 — forked from aharshac/Fetch URL title - Node.js
Node.js snippet to fetch URL title
View Fetch URL title - Node.js
@a Fetch a uniform resource locator title using NodeJS
@d Nov 6, 2018 at 10:10 AM
@tlid 181106091002
@metatxt Automatic formatting of uniform of the service location when it is posted
@s Working
jgwill / nodejs-cli-1811071711.js
Last active Nov 7, 2018
NodeJS parse argument using minimist package for Console App
View nodejs-cli-1811071711.js
// cliapp.js
"use strict";
const args = require("minimist")(process.argv.slice(2));
jgwill / mysql-safe-HTML-escaped-view.sql
Last active Nov 7, 2018
MySQL Escape HTML char from a SQL view so right out of SQL the Text is Safe for browser
View mysql-safe-HTML-escaped-view.sql
--Fix inserting Script into code being executed
select `af_chat`.`tbl_chat`.`Id` AS `Id`,`af_chat`.`tbl_chat`.`Tlid` AS `Tlid`,
AS `ChatLine`,
View x.get-clipboard.js
//@stcgoal Getting clipboard in NodeJS, thanks to :
const clipboardy = require('clipboardy');
var r = clipboardy.readSync();
jgwill / make-path.js
Created Nov 14, 2018
@stcgoal Combine 2 string to make a Path compatible with windows and linux
View make-path.js
var p = require('path');
var tpath = 'tmp';
tpath = p.join(tpath, 'mysubdir');