Skip to content

Instantly share code, notes, and snippets.

View iamsubrataaich's full-sized avatar
🏠
Working from home

SUBRATA AICH iamsubrataaich

🏠
Working from home
View GitHub Profile
@awebartisan
awebartisan / dynamic_input_fields.html
Created March 1, 2021 09:29
Dynamic input fields with Alpine.js
<div x-data="{ bankAccounts: [{
id: '',
accountNumber: ''
}] }">
<template x-for="(bankAccount, index, bankAccounts) in bankAccounts" :key="index">
<div class="grid grid-cols-6 gap-6 mt-2">
<div class="col-span-3 md:col-span-3 sm:col-span-2">
<x-jet-label for="city">Bank</x-jet-label>
<select :name="`bank_info[${index}][bank_id]`" id="bank"
class="border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm mt-1 block w-full">
@thomaspoignant
thomaspoignant / Makefile
Last active June 10, 2024 01:23
My ultimate Makefile for Golang Projects
GOCMD=go
GOTEST=$(GOCMD) test
GOVET=$(GOCMD) vet
BINARY_NAME=example
VERSION?=0.0.0
SERVICE_PORT?=3000
DOCKER_REGISTRY?= #if set it should finished by /
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true
GREEN := $(shell tput -Txterm setaf 2)
@rmiyazaki6499
rmiyazaki6499 / deploy-mern.md
Last active February 24, 2024 05:44
Deploying a Production ready React-Express app on AWS EC2 with CI/CD

Deploying a Production ready React-Express app on AWS

In this tutorial, I will be going over to how to deploy a Javascript app from start to finish using AWS and EC2. Recently, my partner Tu and I launched our app AlgoAcademy (a resource for reviewing algorithms and data structures) and we wanted to share with other developers some of the lessons we learned along the way.

Following this tutorial, you will have an application that has:

  • A React frontend, Express backend
  • An AWS EC2 server configured to host your application
  • SSL-certification with Certbot
  • A custom domain name
@wpichl
wpichl / clionboostlibrary.txt
Last active October 11, 2022 14:46
CLion Boost Library
CMakeLists:
set(BOOST_ROOT "C:/boost_1_70_0")
set(BOOSTROOT "C:/boost_1_70_0")
find_package(Boost 1.70.0)
set(Boost_INCLUDE_DIR C:/boost_1_70_0/)
set(Boost_LIBRARY_DIR C:/boost_1_70_0/stage/lib)
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR})
@AnalyzePlatypus
AnalyzePlatypus / vue-click-outside.md
Last active April 27, 2024 05:32
Vue.js 2.7: Detect clicks outside an element (Close modals, popups, etc.)

Detecting outside clicks in Vue.js

See this StackOverflow thread

First off, include the directive at the end of this gist.

  1. On your open button, make sure to use @click.stop to prevent the open click event from closing your modal.
  2. On your modal, add the v-click-outside directive and points it at a function to call when clicked outside.

Example:

@prakashpandey
prakashpandey / CustomResponseWriter.go
Last active March 19, 2024 21:34
Implement custom http.ResponseWriter in golang
package main
import (
"fmt"
"net/http"
)
type CustomResponseWriter struct {
body []byte
statusCode int
@navix
navix / readme.md
Last active November 23, 2022 09:18
Prevent leaving from any page using Router in Angular 7

Prevent leaving from any page using Router in Angular 7

Angular has CanDeactivate guard, but you have to declare it to each path in the routes configuration.

Valid until angular/angular#11836 will be done.

You can use CanActivateChild guard to prevent leaving from any component with single declaration.

leave-guard.service.ts

@denji
denji / NGINX-HTTP-Request-Stages.md
Last active March 12, 2024 08:31
NGINX HTTP Request Stages

NGINX actual HTTP Request processing flow is divided into 11 stages.

The reason for this division is to perform logical subdivision request to the module as a processing unit, the various stages can contain any number of HTTP modules and pipelined manner request.

The advantage of this is to make the process more flexible, reducing the degree of coupling.

These 11 HTTP stages are as follows:

  1. NGX_HTTP_POST_READ_PHASE ― The phase of the read request;
@logrusorgru
logrusorgru / load.go
Last active November 18, 2023 10:50
Golang load HTML templates
//
// Copyright (c) 2018 Konstanin Ivanov <kostyarin.ivanov@gmail.com>.
// All rights reserved. This program is free software. It comes without
// any warranty, to the extent permitted by applicable law. You can
// redistribute it and/or modify it under the terms of the Do What
// The Fuck You Want To Public License, Version 2, as published by
// Sam Hocevar. See below for more details.
//