This file contains hidden or 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; | |
| use Exception; | |
| enum MonthsEnum: int | |
| { | |
| case JANUARY = 1; | |
| case FEBRUARY = 2; |
This file contains hidden or 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 | |
| /** | |
| * Below is an the extended Filament resource your tenant panel resources | |
| * will have to extend so that the queries are scoped properly. | |
| */ | |
| namespace App\Filament; | |
| use Filament\Resources\Resource; |
This file contains hidden or 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
| import { navigate } from "gatsby-link"; | |
| import { useMoralis } from "./useMoralis"; | |
| export function useAuth() { | |
| const { Moralis } = useMoralis(); | |
| return { | |
| login: async () => { | |
| try { | |
| const user = await Moralis?.Web3.authenticate(); | |
| navigate("/"); |
This file contains hidden or 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
| // This function converts the byte to the corresponding amount, be it kilo, mega, GB, etc. | |
| const convertWeightByte = (byte) => { | |
| let sizekiloByte = (byte / 1024); | |
| let sizeMega = (sizekiloByte / 1024); | |
| let sizeGigabyte = (sizeMega / 1024); | |
| let sizeTerabyte = (sizeGigabyte / 1024); | |
| let sizePetabyte = (sizeTerabyte / 1024); | |
| let sizeExabyte = (sizePetabyte / 1024); | |
| if(sizekiloByte > 0 && sizekiloByte <= 1024){ |
This file contains hidden or 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
| /* Masonry grid */ | |
| .masonry { | |
| transition: all .5s ease-in-out; | |
| column-gap: 10px; | |
| column-fill: initial; | |
| } | |
| /* Masonry item */ | |
| .masonry .brick { | |
| vertical-align: top; /* Keep the item on the very top */ |
This file contains hidden or 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
| // Instalar react-navigation/native | |
| npm install @react-navigation/native | |
| // Instalar las dependencias | |
| npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view | |
| // Instalar navegación en Stack | |
| npm i @react-navigation/stack |
This file contains hidden or 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
| { | |
| "productos": [ | |
| { | |
| "id": 1, | |
| "nombre": "Jugo de Zanahoria", | |
| "precio": "31111" | |
| }, | |
| { | |
| "id": 2, | |
| "nombre": "Jugo de Naranja", |
This file contains hidden or 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
| let fancyTimeFormat = function (time) { | |
| // Hours, minutes and seconds | |
| var hrs = ~~(time / 3600); | |
| var mins = ~~((time % 3600) / 60); | |
| var secs = ~~time % 60; | |
| // Output like "1:01" or "4:03:59" or "123:03:59" | |
| var ret = ""; | |
| if (hrs > 0) { |
This file contains hidden or 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
| function parseJwt (token) { | |
| var base64Url = token.split('.')[1]; | |
| var base64 = base64Url.replace('-', '+').replace('_', '/'); | |
| return JSON.parse(window.atob(base64)); | |
| }; |
This file contains hidden or 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
| /* | |
| * Handling Errors using async/await | |
| * Has to be used inside an async function | |
| */ | |
| try { | |
| const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
| // Success 🎉 | |
| console.log(response); | |
| } catch (error) { | |
| // Error 😨 |
NewerOlder