Skip to content

Instantly share code, notes, and snippets.

@5SMNOONMS5
5SMNOONMS5 / animated-text-circle.markdown
Created September 3, 2025 08:59
Animated Text Circle
@5SMNOONMS5
5SMNOONMS5 / alias.pl
Last active March 18, 2024 15:15
personal alias for mac OS
### Normal
alias cl_ipconfig='ifconfig | grep inet'
### iOS
alias cl_show_simulators='xcrun simctl list'
alias cl_open_xcode_matadata='open -a finder ~/Library/Developer/Xcode'
alias cl_open_provisioning_profiles='open -a finder ~/Library/MobileDevice/Provisioning\ Profiles/'
@5SMNOONMS5
5SMNOONMS5 / ๅฐ็ฃ่บซๅˆ†่ญ‰่ช่ญ‰.swift
Last active February 13, 2023 02:42
ๅฐ็ฃ่บซๅˆ†่ญ‰่ช่ญ‰ swift 5
//A ๅฐๅŒ—ๅธ‚ J ๆ–ฐ็ซน็ธฃ
//B ๅฐไธญๅธ‚ K ่‹—ๆ —็ธฃ T ๅฑๆฑ็ธฃ
//C ๅŸบ้š†ๅธ‚ U ่Šฑ่“ฎ็ธฃ
//D ๅฐๅ—ๅธ‚ M ๅ—ๆŠ•็ธฃ V ๅฐๆฑ็ธฃ
//E ้ซ˜้›„ๅธ‚ N ๅฝฐๅŒ–็ธฃ W ้‡‘้–€็ธฃ
//F ๅฐๅŒ—็ธฃ O ๆ–ฐ็ซนๅธ‚ X ๆพŽๆน–็ธฃ
//G ๅฎœ่˜ญ็ธฃ P ้›ฒๆž—็ธฃ
//H ๆกƒๅœ’็ธฃ Q ๅ˜‰็พฉ็ธฃ Z ้€ฃๆฑŸ็ธฃ
//I ๅ˜‰็พฉๅธ‚
# Thanks to here https://stackoverflow.com/questions/13861658/is-it-possible-to-search-though-all-xcodes-logs
EXT=".xcactivitylog"
for LOG in *.xcactivitylog; do
NAME=`basename $LOG $EXT`
gunzip -c -S $EXT "${NAME}${EXT}" > "${NAME}.log"
done
@5SMNOONMS5
5SMNOONMS5 / Demo.js
Last active November 4, 2021 02:21
Find first match chinese and insert some text before it
function insertBeforeFirstChinese(string, insertedString) {
// cf. https://stackoverflow.com/questions/21109011/javascript-unicode-string-chinese-character-but-no-punctuation
const index = string.split("")
.findIndex(char => /\p{Script=Han}/u.test(char))
if (index > 0) {
string = string.substr(0, index) + insertedString + string.substr(index);
}
@5SMNOONMS5
5SMNOONMS5 / CacheMiddleware.php
Last active September 29, 2021 06:22
CacheMiddleware for laravel version 7
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
// @TIP: Import your CacheService depends on your namespace
use App\Service\Cache\CacheService;
@5SMNOONMS5
5SMNOONMS5 / CacheService.php
Last active September 29, 2021 04:26
CacheService
<?php
namespace App\Service\Cache;
use Illuminate\Support\Facades\Cache;
final class CacheService
{
/**
* Is cache has value by given key and tags
import UIKit
import SnapKit_Sources
import PlaygroundSupport
final class TestView: UIView {
let labelPrimary: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 25)
label.textColor = .black
@5SMNOONMS5
5SMNOONMS5 / to_lowercase.sh
Last active August 31, 2020 05:28
Change file name to lower case
# Ref: https://stackoverflow.com/questions/7787029/how-do-i-rename-all-files-to-lowercase
for f in *; do mv "$f" "$f.tmp"; mv "$f.tmp" "`echo $f | tr "[:upper:]" "[:lower:]"`"; done
@5SMNOONMS5
5SMNOONMS5 / mysql-docker.sh
Created June 17, 2020 08:33 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE