Skip to content

Instantly share code, notes, and snippets.

View techlab23's full-sized avatar
🚀
Right steps

Shirish Nigam techlab23

🚀
Right steps
  • Techlab23
  • Brisbane, Australia
  • 19:51 (UTC +10:00)
  • X @_shirish
View GitHub Profile
@techlab23
techlab23 / sentry.client.ts
Created February 22, 2024 14:29
Sentry Nuxt 3 Plugin
import { defineNuxtPlugin } from '#app'
import * as Sentry from '@sentry/vue'
export default defineNuxtPlugin((nuxtApp) => {
const router = useRouter()
const config = useRuntimeConfig()
Sentry.init({
app: nuxtApp.vueApp,
dsn: config.public.sentryDsn,
@techlab23
techlab23 / csv-processor.ts
Last active January 25, 2024 06:16
Memory efficient large CSV processing
import { createReadStream } from 'node:fs';
import { parse } from 'csv-parse';
async function efficientReadAndParse() {
const readStream = createReadStream('VEStdEquip.csv', 'utf-8').pipe(parse({ delimiter: ',', columns: ['VehicleKey', 'EquipDescription'] }));
for await (const data of readStream) {
await processData(data);
}
@techlab23
techlab23 / sentry.client.ts
Created August 11, 2023 02:02
Sentry Client Plugin For Nuxt 3
import { defineNuxtPlugin } from '#app'
import * as Sentry from '@sentry/vue'
export default defineNuxtPlugin((nuxtApp) => {
const router = useRouter()
const config = useRuntimeConfig()
Sentry.init({
app: nuxtApp.vueApp,
dsn: config.public.sentryDsn,
@techlab23
techlab23 / mutations.js
Created March 1, 2018 05:33
Vuex mutations with add, edit and delete entries
import Vue from 'vue'
import * as types from './mutation-types'
export default {
// Mutation to set entries in state
[types.SET_ENTRIES] (state, entries) {
state.entries = entries || {}
},
// Mutation to add entry in state
@techlab23
techlab23 / machine.js
Created January 20, 2021 04:26
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@techlab23
techlab23 / machine.js
Last active January 19, 2021 02:24
Generated by XState Viz: https://xstate.js.org/viz
const basicDetails = {
initial: 'restore_application',
states: {
restore_application: {
on: { NEXT_CARD: 'submit_details' }
},
submit_details: {
on: { PREVIOUS_CARD: 'restore_application' },
type: 'final'
}
@techlab23
techlab23 / Sample.vue
Last active October 16, 2020 05:24
Vue Component
<template>
<div>
<h1> {{ message }} </h1>
<div
</template>
<script>
export default {
/* Child component registration */
components: {},
@techlab23
techlab23 / kernel.php
Created July 30, 2020 08:23
Laravel sanctum configuration
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful;
class Kernel extends HttpKernel
{
/**
@techlab23
techlab23 / syntax.php
Created July 30, 2020 06:28
Laravel sanctum configuration
Laravel configuration
=====================
composer packages
-----------------
"php": "^7.2.5",
"laravel/framework": "^7.0",
"fruitcake/laravel-cors": "^2.0",
"laravel/sanctum": "^2.4",
@techlab23
techlab23 / login.vue
Created July 30, 2020 06:16
Login component usage (sanctum csrf-cookie route and nuxt login)
<template>
<div class="flex justify-center items-center h-screen">
<div class="w-full max-w-xs">
<form class="bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4">
<div class="mb-4">
<label
class="block text-gray-700 text-sm font-bold mb-2"
for="username"
>
Username