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 | |
namespace App\Enums; | |
trait EnumToArray | |
{ | |
public static function names(): array | |
{ | |
return array_column(self::cases(), '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
/* | |
Author: Javier Antonio Llanos Marriaga | |
Github: @javierllns | |
LinkedIn: https://www.linkedin.com/in/javierllns/ | |
Portfolio: https://javierllns.github.io/ | |
- | |
File name: ShadcnSimplifiedCombobox.tsx | |
Description: A "simplified" "form-like-style" "stylable" version of Shadcn UI combobox examples. | |
License: MIT | |
- |
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
/** | |
* Mass (bulk) insert or update on duplicate for Laravel 4/5 | |
* | |
* insertOrUpdate([ | |
* ['id'=>1,'value'=>10], | |
* ['id'=>2,'value'=>60] | |
* ]); | |
* | |
* | |
* @param array $rows |
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 transfer($fromAccountId, $toAccountId, $amount) | |
{ | |
DB::beginTransaction(); | |
try { | |
$fromQuery = Account::whereId($fromAccountId); | |
if (! $fromQuery->exists()) { | |
throw new InvalidAccountException(); |
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 transfer($fromAccountId, $toAccountId, $balance) | |
{ | |
$fromQuery = Account::whereId($fromAccountId); | |
if (! $fromQuery->exists()) { | |
throw new InvalidAccountException(); | |
} | |
$toQuery = Account::whereId($toAccountId); |
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
"use client"; | |
import { zodResolver } from "@hookform/resolvers/zod"; | |
import { useForm } from "react-hook-form"; | |
import MoneyInput from "src/components/custom/money-input"; | |
import { Button } from "src/components/ui/button"; | |
import { Form } from "src/components/ui/form"; | |
import * as z from "zod"; | |
const schema = z.object({ |
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
// same as your regular shadcn datatable implementation (which uses tanstack table) | |
// note that the shadcn datatable uses shadcn table for the ui. see https://ui.shadcn.com/docs/components/data-table | |
import { | |
ColumnFiltersState, | |
SortingState, | |
VisibilityState, | |
flexRender, | |
getCoreRowModel, | |
getFilteredRowModel, |
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
name: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build-and-deploy: | |
concurrency: ci-${{ github.ref }} |
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
name: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build-and-deploy: | |
concurrency: ci-${{ github.ref }} |
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
const convertToKebabCase = (string) => { | |
return string.replace(/\s+/g, '-').toLowerCase(); | |
} |
NewerOlder