Skip to content

Instantly share code, notes, and snippets.

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

Amitav Roy amitavroy

🏠
Working from home
View GitHub Profile
@amitavroy
amitavroy / button.tsx
Last active May 10, 2022 04:14
Some useful React codes
// A sample button component with proper Typescript definitions
// and it also spreads all props coming from the parent component
import { HTMLAttributes, ReactNode } from "react";
interface Props extends HTMLAttributes<HTMLButtonElement> {
children: ReactNode;
variant: "primary" | "secondary";
}
@amitavroy
amitavroy / .php-cs-fixer.php
Created December 5, 2021 08:34
php cs fixer rules for Laravel
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null],
@amitavroy
amitavroy / Dockerfile
Created November 23, 2021 01:54
Composer PHP 7.4 Docker file
FROM phpdockerio/php74-cli as php
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /app
CMD ["composer"]
@amitavroy
amitavroy / aws_ec2_start_stop.json
Last active January 23, 2024 10:15
AWS EC2 Start Stop Lambda
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:Start*",
"ec2:Stop*",
"ec2:DescribeInstanceStatus"
@amitavroy
amitavroy / TimeEntrySeeder.php
Created August 15, 2020 06:09
Get a lot of Time Entries
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\TimeEntry;
use Faker\Generator as Faker;
$factory->define(TimeEntry::class, function (Faker $faker) {
$username = [
'Amitav',
@amitavroy
amitavroy / MySQL for Telescope tables
Created June 4, 2019 08:52
Create the table for Telescope to work
CREATE TABLE `telescope_entries` (
`sequence` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch_id` char(36) COLLATE utf8mb4_unicode_ci NOT NULL,
`family_hash` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`should_display_on_index` tinyint(1) NOT NULL DEFAULT 1,
`type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`content` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` datetime DEFAULT NULL,
PRIMARY KEY (`sequence`),
@amitavroy
amitavroy / curl.md
Created April 26, 2019 07:11 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@amitavroy
amitavroy / composer.json
Created April 20, 2019 05:33
Packages from local folder and private repo
"repositories": [
{
"type": "path",
"url": "./packages/test"
},
{
"type": "vcs",
"url": "https://github.com/amitavroy/package-name"
}
]
@amitavroy
amitavroy / docker_on_ubuntu.sh
Last active December 4, 2021 08:54
Installing Docker on a new Ubuntu Server
sudo apt update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@amitavroy
amitavroy / Fileupload.vue
Created November 19, 2018 16:35
Vue.js component for a File field which makes an Ajax request to server
<template>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card card-default">
<div class="card-header">Example Component</div>
<div class="card-body upload-file-wrapper">
<input
type="file"