This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function recursively replaces all 'null' string values with undefined in an object or array of objects. | |
* | |
* @author Nimit Suwannagate <ethaizone@hotmail.com> | |
* | |
* @param {T} obj - The object or array of objects to process. The object's values can be of type string, number, or undefined. | |
* @returns {T} - The processed object or array of objects with all 'null' string values replaced with undefined. | |
* | |
* @template V - The type of the values in the object. Defaults to string | number | undefined. | |
* @template R - The type of the object. Defaults to Record<string, V>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FYI. I added this as history data but I don't use it on actual project because `createAsyncThunk` did serialize on error object. | |
import { isRejected, isRejectedWithValue } from '@reduxjs/toolkit' | |
import type { AnyAction, Middleware, MiddlewareAPI } from '@reduxjs/toolkit' | |
import * as Sentry from '@sentry/react' | |
/** | |
* Log a error and send to sentry | |
*/ | |
export const sentryMiddleware: Middleware = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Thanks http://stackoverflow.com/questions/1638337/the-best-way-to-synchronize-client-side-javascript-clock-with-server-date | |
var serverTimeOffset = false; | |
function getServerTime(callback) { | |
if (serverTimeOffset === false) { | |
var scripts = document.getElementsByTagName("script"), | |
URL = scripts[scripts.length - 1].src; | |
var clientTimestamp = Date.parse(new Date().toUTCString()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Array collection helpers | |
* | |
* Ported from Laravel4. | |
* By EThaiZone | |
*/ | |
if ( ! function_exists('array_add')) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// android store | |
if (preg_match('#android#i', $_SERVER ['HTTP_USER_AGENT'])) { | |
header('Location: market://details?id=com.google.android.apps.maps'); | |
exit; | |
} | |
// ios | |
if (preg_match('#(iPad|iPhone|iPod)#i', $_SERVER ['HTTP_USER_AGENT'])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
echo type "commit" or "update" | |
cd "curl" | |
set GIT_PATH="C:\Program Files (x86)\Git\bin\git.exe" | |
set BRANCH = "origin" | |
:P | |
set ACTION= | |
set /P ACTION=Action: %=% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bson import ObjectId | |
import functools | |
# Created by Nimit Suwannagate | |
def recursive_all(f): | |
""" | |
Decorator for making recursive function. | |
:param f: | |
:return: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~320kbps | |
## ANISON.FM | |
http://pool.anison.fm:9000/AniSonFM(320) | |
# ~128kbps | |
## Radio Forever Anime | |
http://199.168.188.202:9310/ | |
## AnimeNfo Radio | |
http://itori.animenfo.com:443/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('mb_str_split')) { | |
/** | |
* Convert a multibyte string to an array | |
* | |
* @param string $string The input string. | |
* @param integer $split_length Maximum length of the chunk. | |
* @param string $encoding The encoding parameter is the character encoding. | |
* @return array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
basedir=`dirname "$0"` | |
# This is like symlink for bash cmd such as mintty, GIT bash, Cygwin | |
# I pass parameters to it too. | |
"$basedir/pstorm.cmd" "$@" | |
# Note - I tried create symlink but it not work at bash environment |
NewerOlder