Skip to content

Instantly share code, notes, and snippets.

View dolphinotaku's full-sized avatar
🎯
Focusing

Keith POON dolphinotaku

🎯
Focusing
  • Freelance
  • Hong Kong
View GitHub Profile
@dolphinotaku
dolphinotaku / index.html
Last active June 28, 2018 04:12
jQuery – How to automatically create heading anchors for links
<!DOCTYPE html>
<html>
<head>
<title>How to automatically create heading anchors for links</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/cferdinandi/smooth-scroll@14/dist/smooth-scroll.polyfills.min.js"></script>
<style>
.anchorBtn {
margin-left: 15px;
@dolphinotaku
dolphinotaku / form-feed.js
Created July 14, 2018 13:30
one click for filling the several similar forms
var array = {
"d_act_group": "18-24",
"declare": "2",
"eng_name":""
}
function simulateInput(keyPairValue){
for (var index in keyPairValue){
@dolphinotaku
dolphinotaku / check_o365URLs.ps1
Created July 16, 2018 02:09
Office 365 performance turning
$textfile = $file_speed2o365
if (Test-Path $textfile)
{
Remove-Item $textfile
}
foreach($url in $o365_URLs) {
echo "" >> $textfile
<!DOCTYPE html>
<html>
<head>
<title>Typing text like subtitle/caption</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="../third-party/typed.js-2.0.9/lib/typed.js"></script>
<script>
$(document).ready(function() {
var plainText = null;
@dolphinotaku
dolphinotaku / find2nd4thsunday.js
Last active March 4, 2019 04:12
find the next sunday by even week per month
// calculate the 2nd and 4th sunday
// https://stackoverflow.com/questions/21514245/find-second-sunday-of-every-may-depending-on-the-year
function GetNextEvenDateOfSunday(asAtDate){
// remove time from Date
asAtDate.setHours(0);
asAtDate.setMinutes(0);
asAtDate.setSeconds(0);
var currentYear = asAtDate.getFullYear();
@dolphinotaku
dolphinotaku / ScheduleTaskOne.java
Last active June 26, 2019 17:47
How to implement a scheduler in Java for send request to PHP
package com;
import java.util.*;
import java.text.*;
import org.apache.http.HttpEntity;
import org.apache.http.util.EntityUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
@dolphinotaku
dolphinotaku / archive_your_project.bat
Created November 26, 2019 02:29
Use batch script to backup folders, files and compress by 7zip
:: initialize currenct date time variable
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a
set YYYY=%dt:~0,4%
set MM=%dt:~4,2%
set DD=%dt:~6,2%
set HH=%dt:~8,2%
set Min=%dt:~10,2%
set Sec=%dt:~12,2%
:: set stamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%
@dolphinotaku
dolphinotaku / composer.syntax.example.txt
Last active November 30, 2019 10:34
How to use composer on win
// check composer version
composer --version
// add/install resource, the added resource will append to the composer.json
// e.g
composer require phpoffice/phpspreadsheet
composer require soundasleep/html2text
// install the resource with a specified version
composer require phpoffice/phpspreadsheet:1.8.2
@dolphinotaku
dolphinotaku / php.ini
Last active December 9, 2019 15:25
PHP 7.0+ config for IIS
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
eyJwcmV2aW91cyI6e30sInZlcnNpb24iOjEuMywiZmVhdHVyZXMiOnsibG9jYXRpb24iOnsicm9vbSI6dHJ1ZSwib3V0c2lkZSI6dHJ1ZSwid29ybGQiOnRydWV9fSwic3RvcmVzIjp7Indvb2QiOjExNDU2LCJmdXIiOjE2ODIuNSwiYmFpdCI6OTU3LCJtZWF0IjoxNjU5OS41LCJzY2FsZXMiOjI1LCJ0ZWV0aCI6MTAwLCJjbG90aCI6MSwiY2hhcm0iOjIsImxlYXRoZXIiOjI1NzksImN1cmVkIG1lYXQiOjExMTgsInRvcmNoIjoxLCJ3YXRlcnNraW4iOjEsImJvbmUgc3BlYXIiOjIsInJ1Y2tzYWNrIjoxLCJsIGFybW91ciI6MSwiY29tcGFzcyI6MSwiaXJvbiI6MTUsInN0ZWVsIjoxNSwibWVkaWNpbmUiOjgsImNhc2siOjF9LCJjaGFyYWN0ZXIiOnsic3RhcnZlZCI6NywicGVya3MiOnsic3RlYWx0aHkiOnRydWUsImJhcmJhcmlhbiI6dHJ1ZSwic2NvdXQiOnRydWV9fSwiaW5jb21lIjp7ImdhdGhlcmVyIjp7ImRlbGF5IjoxMCwic3RvcmVzIjp7Indvb2QiOjI3fSwidGltZUxlZnQiOjF9LCJidWlsZGVyIjp7ImRlbGF5IjoxMCwic3RvcmVzIjp7Indvb2QiOjJ9LCJ0aW1lTGVmdCI6MX0sImh1bnRlciI6eyJkZWxheSI6MTAsInN0b3JlcyI6eyJmdXIiOjIwLCJtZWF0IjoyMH0sInRpbWVMZWZ0Ijo2fSwidHJhcHBlciI6eyJkZWxheSI6MTAsInN0b3JlcyI6eyJtZWF0IjotMSwiYmFpdCI6MX0sInRpbWVMZWZ0Ijo2fSwidGFubmVyIjp7ImRlbGF5IjoxMCwic3RvcmVzIjp7ImZ1ciI6LTE1LCJsZWF0aGVyIjozfSwidGltZUxlZnQiOjEwfSwiY2hhcmN1