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 / php7_pthreads.sh
Created May 7, 2018 06:57 — forked from giapt/php7_pthreads.sh
PHP7 with Thread
#!/bin/bash
apt-get update
apt install -y libzip-dev bison autoconf build-essential pkg-config git-core \
libltdl-dev libbz2-dev libxml2-dev libxslt1-dev libssl-dev libicu-dev \
libpspell-dev libenchant-dev libmcrypt-dev libpng-dev libjpeg8-dev \
libfreetype6-dev libmysqlclient-dev libreadline-dev libcurl4-openssl-dev
cd $HOME
wget https://github.com/php/php-src/archive/php-7.2.4.tar.gz
tar --extract --gzip --file php-7.2.4.tar.gz
@trungx
trungx / _notes.md
Created May 7, 2018 10:05 — forked from sgnl/_notes.md
AJAX with Vanilla Javascript. (XMLHttpRequest)

Short XHR Examples

Examples shown are bare minimum needed to achieve a simple goal.

Resources

  • Google Chrome's Dev Tools' Network Panel c-c-c-c-c-ULTIMATE c-c-c-COMBO!!!
  • requestb.in enpoints for your HTTP Requests as a free service.
@trungx
trungx / PHP Clean It
Created May 15, 2018 04:07 — forked from james2doyle/PHP Clean It
php cleanstring function
function cleanit($input) {
$input = trim(preg_replace('/\s*\([^)]*\)/', '', $input));
$input = preg_replace('/[^a-zA-Z0-9]/s', '', $input);
return strtolower($input);
}
@trungx
trungx / bitsadmin.md
Created May 15, 2018 16:44 — forked from xnohat/bitsadmin.md
Use bitsadmin to download via the command line on Windows 7 (8?)

Download via the command line on Windows 7

If you want to test your connection or have some other reason to use the command line to download a file, this is how.

See http://superuser.com/a/284147 for more information.

Open cmd.exe and use this format:

bitsadmin /transfer debjob /download /priority normal http://cdimage.debian.org/debian-cd/current-live/i386/iso-hybrid/debian-live-8.7.1-i386-xfce-desktop.iso D:\Users\[Username]\Downloads\debian-live-8.7.1-i386-xfce-desktop.iso
@trungx
trungx / url-segment.js
Created May 28, 2018 10:33 — forked from jserrao/url-segment.js
Get Last Segment of a URL in Javascript
var pageURL = window.location.href;
var lastURLSegment = pageURL.substr(pageURL.lastIndexOf('/') + 1);
console.log(lastURLSegment);
@trungx
trungx / Contract Killer 3.md
Created June 27, 2018 09:47
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@trungx
trungx / my hosts
Created July 23, 2018 16:52 — forked from ptk911/my hosts
1. GetLink Fs4sTL:
<version1>5.0</version1>
<download1>https://www.fshare.vn/file/XEVWQMO9WLZX</download1>
2. Music-Video Downloader:
<version2>2.9</version2>
<download2>https://www.fshare.vn/file/NUY37GFGPW6U</download2>
3. GetLink F4sTL-MVD:
<version3>4.6.6</version3>
@trungx
trungx / 1-WSL and Docker for Windows.md
Created August 13, 2018 09:26 — forked from kekru/1-WSL and Docker for Windows.md
Windows 10 Subsystem for Linux combined with Docker for Windows

Using Windows Subsystem for Linux combined with Docker for Windows

Docker CE for Windows

  • Install Docker CE for Windows
  • Go to Docker for Windows Settings -> General and enable Expose daemon on tcp://localhost:2375 without TLS.
    This will enable the Docker remote API for requests, coming from localhost, not from another computer in your network. A TLS secured version is not yet supported in Docker for Windows. See docker/for-win#453 for more information. I also tried a daemon.json file with options tlscacert, tlscert, tlskey and tlsverify, but Docker for Windows crashed on booting.

Install Windows Subsystem for Linux (WSL)

@trungx
trungx / slugify.js
Created August 15, 2018 09:02 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@trungx
trungx / slugify.js
Created August 15, 2018 09:02 — forked from codeguy/slugify.js
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}