Sign in

If you want to develop your package, you should have a question for it, how to make develop blazing here is my strategy for package development.

Repositories — Composer

If your package just depends on your application, you could consider this one, the reason is, you can write tests depends on your application, for pros following:
1. you don’t worry any mock the others flow in your application, it’s a coupling.
2. you can choose tests where you want to put inside package or application(inside or outside) depends or not.


It’s about vanilla PHP, here is documentation PHP: Traits — Manual, here is an example.

trait Taggable
{
public function slug()
{
return Str::slug($this->slug, '-');
}
}

For now, I don’t want to make a string slugging for the slug, I would like changing to the snake, in the past…


Laravel Sanctum is a lightweight authentication system for SPAs and mobile, it’s the token based APIs, here is a simple example with Vue.js.

Firstly, initial the project and require sanctum.

$ composer create-project --prefer-dist laravel/laravel laravel8
$ composer require laravel/sanctum
$ php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
$ php artisan migrate

app/Http/Kernel.php

'api' => [
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],

Set all of the environment and database, go into the tinker, and create a user, by default with laravel, the password should be ‘password’.

Continue to read….


From my situation, I need to test my request validation rules, but here is a problem, I think I DO NOT make a request to the real route, so I have to create a fake controller and add to my test case, here is my solution.

/**
* @dataProvider resend…


Ordering the middleware through, I traced the underlying instance Illuminate\Foundation\Http\Kernel

/**
* The priority-sorted list of middleware.
*
* Forces non-global middleware to always be in the given order.
*
* @var array
*/
protected $middlewarePriority = [
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\Illuminate\Contracts\Auth\Middleware\AuthenticatesRequests::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Auth\Middleware\Authorize::class,
];

And I found two methods: prependToMiddlewarePriority and appendToMiddlewarePriority, there is a different thing, array_unshift.

Here is a simple to describe.

protected $middlewarePriority = [
// prepend middleware
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\Illuminate\Contracts\Auth\Middleware\AuthenticatesRequests::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Auth\Middleware\Authorize::class,
// append middleware
];

So, where are we calling the method? App\HttpKernel and overwrite __construct after parent construct.

public function __construct(Application $app, Router $router)
{
parent::__construct($app, $router);
$this->appendToMiddlewarePriority(One::class);
$this->appendToMiddlewarePriority(Two::class);
$this->appendToMiddlewarePriority(Three::class);
}


For my situations, I need to set period time finishing our project logics, but here is a problem, how can I mock the now from my setting? Fortunately, the php package Carbon provides a few methods to do this.

$knownDate = Carbon::create(2001, 5, 21, 12)…


https://icons8.com

前幾天在 Reddit 上看到一個網友分享自己的 Home widget,相當不錯,由於自己也很喜歡這樣子的東西就動手做了一次,作者很貼心的分享了自己的實作過程,以下是原文的做法:

Step 1

Weather widget: Go to https://weatherwidget.io/ and customize the widget. Change theme type to ‘blank’ in the themes tab. This will only remove the bg color of the widget. Customize the icons and the color as you like and then click on “Get…


This article is showing my schedule daily, my job is programming for web services and data structure, also I’m going to show you about my tooling and service to assist my work.

A day in the life of an engineer

8 AM — 9 AM wake up and clean up myself.

9 AM — 10 AM take an…


去年年初,我寫了一篇從 notion 又回到 bear — Yish — Medium 的文章 ,經過一年使用情境與準確定位兩個優秀產品,現在我完美的把兩個工具整合並融入到工作和生活中,以下是我的分析與使用情境。

Notion 傾向於資料儲存庫的概念,像是稍後再讀的文章或是在 windows 上突然想記錄一些東西(需要比較多資料或內容)時快速記錄下來,當成工作日誌每天記錄工作遇到的內容,這些資料往往是有時效性或是雜亂的,變成是有種 raw data 的方式在記錄資料,對我來說這帶給我很多便利性和彈性,只要是在工作日誌內的資料都是沒有整理過或快速筆記下來的東西,需要從裡面再萃取出內容。
學習語言和每月目標或計畫都會是在這邊完成,這些資料往往都是很分散沒有思考或整理過的資料。
通常在使用 Notion 時,絕大部分時間都會是在電腦前面進行作業,比較少機會會使用 iPhone 或是其他手持裝置進行編寫,一方面還是在其他裝置表現上 Notion 還是沒辦法跟 Bear 進行比較,主要是產品定位的屬性不同而導致功能繁多的狀況。
需要專心記錄長篇結構化筆記時我也是會使用 Notion 作為首選,因為這些資料是透過輸入而筆記下來的。

歸納:
1. 第二大腦
2. 閱讀筆記
3. Web clipper
4. 儲存資料庫

從 Notion 工作日誌或記錄中萃取重要資料並加以整理改進,仔細編排用於分享文章,或是走在路上或是手邊只有手機時可以快速記錄筆記(真的很快),寫日記或隱私資料(因為可以加入密碼保護,這對於私人筆記來說是很重要的功能),最後則是寫文章及技術筆記文章時使用以及代碼片段庫和快速查找。
相比於 Notion,我在使用 iPhone 時如果要記錄或寫一些文章時首選一定是 Bear,透過快速編寫和記錄的優點。
在這邊的筆記都是經由消化與萃取後而透過自己本身的觀察記錄並加入自己的見解而記錄下來的筆記,用於輸出內容。

歸納:
1. 片段代碼
2. 筆記文章
3. 閃電筆記

綜合兩個軟體的優缺點,我將這兩個軟體的優點用於實際工作和生活當中,也在這邊定位這兩個軟體對我來說比較好的用法:

(輸入)Notion -> 結構化整理資料與記錄,適合概念與思維記錄、電子書與長篇筆記。
(輸出)Bear -> 快速記錄與 markdown 支持,適合片段代碼與技術文章撰寫。

如果用白話一點來說明使用情境上的定位,我個人會將這兩個軟體分別定位為:

Notion
用於輸入,紀錄資料和學習資料,原生處理的資料內容,這邊資料往往是多而原生的,相比於輸出筆記資料庫龐大但齊全。

Bear
用於輸出,把輸入資料經由思考與萃取後,輸出到部落格或是平台上,加入自己的見解與看法成為自己的思考筆記。

概念上會是這樣子分配,實際上還是有時候會有些例外狀況,舉例來說如果沒有 Mac 時又想整理技術文章就會用 iPhone 把文章複製到 Notion 進行編輯跟撰寫,畢竟工具是用來輔助工作而不是反而限制了用途,保持一定的彈性和交互使用才是善用工具。

https://yish.dev/Notion-Bear


https://github.com/narative/gatsby-theme-novela
https://www.netlifycms.org/

I have been having gatsbyJS site from starter, I used https://www.gatsbyjs.org/starters/lekoarts/gatsby-starter-minimal-blog/, it’s beautiful, I love it but I think I want to change it sometimes, so I choose https://github.com/narative/gatsby-theme-novela, here is a demo: https://novela.narative.co/, here is how do I do for its steps.

It’s simple to take it.

…

Yish

The Explorer 🍻 yish.dev

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store