Skip to content

Instantly share code, notes, and snippets.

View pingcheng's full-sized avatar
🍉

Ping Cheng pingcheng

🍉
View GitHub Profile
@pingcheng
pingcheng / script.sh
Last active September 27, 2023 12:13
Create TypeScript codes with ESLint + Prettier + Nodemon for auto reload
# install ts
npm i typescript --save-dev
npx tsc --init
# update ts config
sed -i '' -e 's/"target": "es2016"/"target": "ES2020"/' tsconfig.json
sed -i '' -e 's/\/\/ "noImplicitAny": true/"noImplicitAny": true/' tsconfig.json
sed -i '' -e 's/\/\/ "strictNullChecks": true/"strictNullChecks": true/' tsconfig.json
# install prettier
@pingcheng
pingcheng / clear-branch.sh
Created September 11, 2019 05:13
Delete merged branches on local
#!/bin/sh
# get all merged branch
branches=$(git branch --merged master | grep -v '^[ *]*master$')
# define colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
LIGHT_GRAY='\e[90m'
NC='\033[0m'
@pingcheng
pingcheng / SlackRequest.php
Last active December 5, 2023 21:11
Laravel middleware for validating slack signing secret
<?php
namespace App\Http\Middleware;
use Exception;
use Carbon\Carbon;
use Closure;
use Illuminate\Support\Facades\Log;
class SlackRequest