Skip to content

Instantly share code, notes, and snippets.

View rc1021's full-sized avatar

許益銘 rc1021

View GitHub Profile
@rc1021
rc1021 / unmerged.sh
Last active November 21, 2025 03:07
這是用來查看哪些分支的 commit 還沒合併到 (target) 分支的功能
#!/bin/bash
# 默認格式
FORMAT="original"
TARGETS=("uat" "sit")
WIDTH_TARGET=10
WIDTH_BRANCH=25
WIDTH_COMMIT=10
WIDTH_DATE=10
@rc1021
rc1021 / README.md
Created December 26, 2024 03:01
php.function strtotime 常識

date + strtotime

echo date('Y-m-d H:i:s', strtotime('+1 year'));
// 假設執行日期 2024-12-25 11:00
// ouput: 2025-12-25 11:00

php.function strtotime 常識

@rc1021
rc1021 / 01_README.md
Last active December 23, 2024 08:22
將 SQL 中的函數占位符 {function:params} 識別並替換為相應的結果

說明

將 SQL 中的函數占位符 {function:params} 識別並替換為相應的結果

$sql = "SELECT * FROM users 
WHERE created_at >= {date:Y-m-d H:i:s,strtotime:value:first day of last month}
AND created_at < {date:Y-m-d H:i:s,strtotime:first day of this month}
";
@rc1021
rc1021 / CsvFileEditor.php
Last active October 16, 2024 09:17
Laravel高效處理CSV文件,不需要使用套件
<?php
namespace App\Commons;
use Illuminate\Support\Facades\Storage;
class CsvFileEditor
{
/** @var string csv檔案路徑 */
public $filepath;
@rc1021
rc1021 / infile-users.sql
Created September 18, 2024 01:31
MySQL infile + outfile 使用方法
use DEMO;
LOAD DATA INFILE '/var/lib/mysql-files/users.csv'
INTO TABLE bankList
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(id, email, password, firstName, lastName, cellPhone, created_at, updated_at);
@rc1021
rc1021 / auto-tag-after-pr.yml
Created February 1, 2024 00:58
PR 合併後自動新增版本號
name: Create Version Tag on PR Merge
on:
pull_request:
types:
- closed
jobs:
create_tag:
runs-on: ubuntu-latest
@rc1021
rc1021 / app.js
Last active March 28, 2022 07:39
變更 resources/js/app.js 以符合 vue3 規格
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
// window.Vue = require('vue').default;
// 改為
@rc1021
rc1021 / update-vue3.sh
Last active March 28, 2022 07:23
升級 Vue 3
npm install -D vue@next
npm install -D @vue/compiler-sfc
npm install vue-loader@^16.2.0 --save-dev --legacy-peer-deps
npm run dev
@rc1021
rc1021 / gist:08c777de74407ab69f4e7b487b1e91bc
Created March 28, 2022 07:11
laravel/ui 初始化 vue 相關目錄和變更一些檔案
demo-app
|- resources
| |- js
| | |- components
| | |- ExampleComponent.vue
| |- app.js
|- package.json // 加入 vue, vue-loader, vue-template-compiler
|- webpack.mix.js // 加入 .vue()
@rc1021
rc1021 / install-with-vue2.sh
Last active March 28, 2022 07:21
新增 Laravel 專案 with Vue2
composer create-project laravel/laravel demo-app "8.6.11"
cd demo-app
composer require laravel/ui --dev
php artisan ui vue