This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This custom cast will help convert a datetime field in database to local timezone of the user | |
* This also convert any input datetime string from user's timezone to the app's default timezone | |
*/ | |
namespace App\Casts; | |
use Carbon\Carbon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Create an element with class 'hero-text' | |
* | |
*/ | |
.hero-text { | |
background: radial-gradient(circle, #0284c7, #ca8a04); | |
background-clip: text; | |
color: transparent; | |
background-size: 200% 200%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'render_block', function( $block_content, $block ) { | |
$field_name = 'start_date'; // ACF field name | |
$postId = false; | |
$format = 'M j, Y g:i A'; // date format | |
$class = 'format-date'; // Additional CSS Class on block to find | |
$string = 'start_date'; // string of text to replace with date | |
$date = get_field( $field_name ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* In this example, we are filtering the custom post type named 'Events' | |
*/ | |
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { | |
// apply filter if loop has class: upcoming-events-grid | |
if (! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'upcoming-events-grid' ) !== false) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { | |
// apply filter if loop has class: courses-grid | |
if (! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'courses-grid' ) !== false) { | |
$query_args = array_merge( $query_args, array( | |
'meta_key' => 'sort_order', | |
'orderby' => 'meta_value', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
/* | |
* Put this code in routes/web.php file | |
*/ | |
use Illuminate\Support\Facades\URL; | |
if(env('APP_ENV') == "production"){ | |
URL::forceScheme('https'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function generateHexColor() : string | |
{ | |
return substr(str_shuffle('ABCDEF0123456789'), 0, 6); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
Route::prefix('/users')->middleware(['auth'])->name('users.')->group(function (){ | |
Route::get('', function(){ | |
return "Users"; | |
})->name('index'); // Will generate Route ('/users') with name ('users.index') | |
Route::get('/edit', function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a .bashrc file in the directory "C:\Users\<User> | |
alias pa='php artisan' | |
alias nr='npm run' | |
alias ga='git add .' | |
alias p='python' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.card-title{ | |
-webkit-line-clamp: 2; // Max number of lines you want to show | |
overflow : hidden; | |
text-overflow: ellipsis; | |
display: -webkit-box; | |
-webkit-box-orient: vertical; | |
} |