Snippets

32 snippets
3 months ago

List of the format for date commands in Bash Script

In Bash, you can use the `date` command to format dates and times in a variety of ways. Here are some common format codes that you can use with the `date` command: - `%a`: abbreviated weekday name...

How to enable mermaid or html directive with marp in VS code

Hello If you are using marp in vscode, and you have issue to render with mermaid js, or if you want to use html directive in your slide, then this tips might be helpful for you. ## Tweak setting...

Set up a new MacBook.

If we have a new machine and need to set up the development environment, you might need a few hours to set up. However, I personally use a script that can help me to set up a new machine within an hou...

How to enable key repeats on your Mac

Hey, If you want to enable key repeats on your Mac, follow the steps down below- 1) Open **Terminal** 2) Enter the following command into Terminal and press enter: ``` defaults write NSG...

How to set fish as default on MacOS

If you are curious to know exactly how to set the [fish](https://fishshell.com/) as a default terminal behaviour on your Mac, here is the simple command that you can use. Open any terminal, paste...

How to get PayPal Access Token with cURL?

Hey, if you are curious to know how to get PayPal access token with cURL, then this post might be helpful for you. ``` $ch = curl_init(); $clientId = "myclientid"; $secret = "mysecret"; curl...

Laravel where() and orWhere() condition together for one column

If you are in a situation where you need to use Laravel `where()` and `orWhere()` condition together for one column, this tip might be helpful for you. Let's dig into a real life scenario. Imagine...

Pass query string in Laravel Pagination globally

If you often need to pass query string in laravel imagination, I believe passing query string globally will be the best choice instead of passing in every method. Here is how you can pass query string...

Handle Laravel Cors via Middleware

If you want to handle Laravel Cors via middleware, here is the way to do that- First create a file name `Cors.php` ``` public function handle($request, Closure $next) { if ($request->isM...

How to add Access-Control-Allow-Origin header response in Laravel

There are few ways to add `Access-Control-Allow-Origin` in header response in Laravel globally. However, I will show you the easiest way to add CORS that I have discovered recently. Go to `bootstrap...

Why ActingAs Not working in Laravel API Testing

Hey, You may come across this post because of your `actingAs()` is not working with Laravel API Testing. I discovered the error of why it was happening with me also. In my case, I use a custom gua...

React JS 'Component' is not defined no-undef

If you suddenly face issue in your React JS that 'Component' is not defined no-undef, then you need to make sure that you imported react js like that way. ``` import React, { Component } from 'reac...

Fix allowed memory size exhausted in Laravel or Lumen

If you suddenly face PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate bytes) in Lumen or Laravel, there are few ways to solve this issue. Most common ways to solve this iss...

How to hide bank card number via Asterisks

If you want to hide bank card (credit / debit) number by asterisks, follow this simple function- ```php function hideNumberByAsterisks($cardNumber){ return str_repeat('*', strlen($cardNumber) - 4)...

Laravel add column in migration file after in any specific column

To add a new column in laravel migration file after in any specific column, follow this step. ``` $table->string('new_adding_column_name')->nullable()->after('after_which_column_name_you_want_to_see_...

  • 1 / 3