Skip to content

Instantly share code, notes, and snippets.


Manish sharma mansha99

View GitHub Profile
View page-reducer.tsx
export const fanSpeedInitial = {
level: 0,
status: 'OFF'
export const ROTATE_RIGHT_ACTION =
{ type: 'ROTATE_RIGHT' };
export const ROTATE_LEFT_ACTION =
{ type: 'ROTATE_LEFT' }
export function fanSpeedReducer(fanSpeed: any, action: any) {
if (action.type == 'ROTATE_RIGHT') {
View page.tsx
"use client";
import { useReducer } from "react";
import { fanSpeedInitial, fanSpeedReducer } from "./page-reducer";
export default function Home() {
const [fanSpeedCurrent, fanSpeedHandler] = useReducer(fanSpeedReducer, fanSpeedInitial);
return (
<main style={{ padding: 20 }}>
mansha99 / resources\views\livewire\calculator.blade.php
Created May 13, 2023 18:28
View for Livewire Calculator Component
View resources\views\livewire\calculator.blade.php
<div style="background: #aaffcc;padding:20;width:240px">
<h5>Calculator Component</h5>
<form wire:submit.prevent="multiply">
<input type="text" wire:model="n1" />
{{ $message }}
mansha99 / resources\views\livewire\receiver.blade.php
Created May 13, 2023 18:13
View for Livewire Receiver Component
View resources\views\livewire\receiver.blade.php
<div style="background: #ffaacc;padding:20;width:240px">
{{$message}} &nbsp;&nbsp;{{$timeStamp}}
mansha99 / App\Http\Livewire\Receiver.php
Created May 13, 2023 18:12
Livewire components receiving Event
View App\Http\Livewire\Receiver.php
namespace App\Http\Livewire;
use Livewire\Component;
class Receiver extends Component
public $message="Received no event so far";
public $timeStamp='';
mansha99 / resources\views\livewire\sender.blade.php
Created May 13, 2023 18:11
View for Livewire Sender Component
View resources\views\livewire\sender.blade.php
<div style="background: #aaccff;padding:20;width:240px">
<button wire:click="fireTimestampEvent()">Gnerate Event </button>
mansha99 / App\Http\Livewire\Sender.php
Created May 13, 2023 18:05
A Laravel Livewire component acting as publisher (Generator) of event
View App\Http\Livewire\Sender.php
namespace App\Http\Livewire;
use Livewire\Component;
class Sender extends Component
public function fireTimestampEvent()
mansha99 / App\Http\Livewire\Calculator.php
Created May 13, 2023 18:02
A Laravel Livewire component displaying Livewire validation in action
View App\Http\Livewire\Calculator.php
namespace App\Http\Livewire;
use Livewire\Component;
class Calculator extends Component
public $n1;
public $n2;
mansha99 / welcome.blade.php
Last active May 1, 2023 19:00
View welcome.blade.php
<livewire:inventors />
mansha99 / inventors.blade.php
Created May 1, 2023 15:04
View inventors.blade.php
<select wire:model="invention">
@foreach ($list as $k => $v)
<option value="{{ $k }}">{{ $k }}</option>
</select> invented by
{{ $inventor }}