Skip to content

Instantly share code, notes, and snippets.

@lufias
lufias / basic-react-hook-form.js
Last active October 3, 2023 04:16
Example of a basic use of react hook form complete with Devtool
import React from "react";
import { TextField, Button, Stack } from "@mui/material";
import { useForm } from "react-hook-form";
import { DevTool } from "@hookform/devtools";
const RequestForm = () => {
const form = useForm({
defaultValues: {
email: "",
password: "",
<script>
import { Component, Prop, Emit } from 'vue-property-decorator'
import Vue from 'vue'
import L from 'leaflet';
@Component
export default class LeafletCircle extends Vue {
@Prop() map
@lufias
lufias / MonthQuery.php
Last active October 13, 2021 12:12
Laravel eloquent example to query previous month
<?php
// Previous month
return Model::where('created_at', '>=', Carbon::now()->startOfMonth()->subMonth())
->where('created_at', '<=', Carbon::now()->startOfMonth()->subMonth()->endOfMonth())
->get();
// Current Month
return Model::where('created_at', '>=', Carbon::now()->startOfMonth()