Skip to content

Instantly share code, notes, and snippets.

View Toxiapo's full-sized avatar
🎯
Focusing

Jiayong Toxiapo

🎯
Focusing
View GitHub Profile
@Toxiapo
Toxiapo / tmux-cheatsheet.markdown
Created February 26, 2021 21:34 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Toxiapo
Toxiapo / monitorTextNode.js
Created May 15, 2020 13:56
Monitor Text node change
var textNode = document.querySelector("$SELECTOR");
textNode.addEventListener("DOMCharacterDataModified", action, false);
function action(evt) {
if($CONDITION) {
window.open("http://www.google.com", "test" ,"modal=yes");
window.focus();
textNode.removeEventListener("DOMCharacterDataModified", action, false);
}
@Toxiapo
Toxiapo / mult-contnet-with-curl.php
Created February 28, 2020 18:57
mult-contnet-with-curl
<?php
function getMultiContents($url_list)
{
$mh = curl_multi_init();
$ch_list = array();
foreach ($url_list as $url) {
$ch_list[$url] = curl_init($url);
curl_setopt($ch_list[$url], CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch_list[$url], CURLOPT_TIMEOUT, 1);
@Toxiapo
Toxiapo / remove-extension-in-url
Created January 17, 2020 06:12
remove-extension-in-url
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
@Toxiapo
Toxiapo / PHP: Describe table
Created September 13, 2019 19:25
PHP: Describe table
$query = "DESCRIBE tablename";
$result = $db->query($query);
while ($row => $result->fetch_array()) {
echo "{$row['Field']} - {$row['Type']};
}
@Toxiapo
Toxiapo / ARDOR: burningMessage in cURL
Created July 11, 2019 19:20
ARDOR: Create a burningMessage with cURL(zero-fee transaction with expiration)
curl \
-F 'requestType=sendMessage' \
-F 'recipient=$recipientAddress' \
-F 'secretPhrase=$password' \
-F 'chain=ignis' \
-F 'message=$publicMessage' \
-F 'messageToEncryptIsText=true' \
-F 'encryptedMessageIsPrunable=true' \
-F 'referencedTransaction=2:dfe36cf9f8dff41f30f1cde92717ee6f1ac2c5342bba7d691b5e0b75a6bc5204' \
-F 'feeNQT=0' \
@Toxiapo
Toxiapo / Spaced Dotted line for borders
Created March 23, 2018 18:17
The style will let you create dotted borders with any sizes and spacings
background-image: linear-gradient(to right, #333 10%, rgba(255, 255, 255, 0) 0%);
background-position: top;
background-size: 10px 1px;
background-repeat: repeat-x;
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
@Toxiapo
Toxiapo / curl helper function
Created July 11, 2019 19:12
curl helper function
function fetchUrl($uri,$method=false) {
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $uri);
curl_setopt($handle, CURLOPT_POST, $method);
curl_setopt($handle, CURLOPT_BINARYTRANSFER, false);
curl_setopt($handle, CURLOPT_HEADER, true);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 10);
@Toxiapo
Toxiapo / REGEX-validate-ARDOR-ADDRESS
Created January 17, 2019 18:57
REGEX AND FILTER: validate ardor address
filter_var($string,FILTER_VALIDATE_REGEXP, array( "options" => array("regexp"=>"/^([a-zA-Z0-9]*-[a-zA-Z0-9]*){4}$/")))