Skip to content

Instantly share code, notes, and snippets.

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

Dipesh KC dipeshhkc

🏠
Working from home
View GitHub Profile
version: '3.3'
services:
rabbitmq:
image: rabbitmq:3-management
ports:
- 5672:5672
- 9000:15672
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
RABBITMQ_DEFAULT_USER=admin
RABBITMQ_DEFAULT_PASS=admin
//SetupRoutes : gin router
func SetupRoutes() {
httpRouter := gin.Default()
//handling CORS
httpRouter.Use(cors.New(cors.Config{
AllowOrigins: []string{"*"},
AllowMethods: []string{"PUT", "PATCH", "GET", "POST", "OPTIONS", "DELETE"},
AllowHeaders: []string{"*"},
AllowCredentials: true,
var RabbitChannel *amqp.Channel
var rabbitConn *amqp.Connection
//SetupRabbbitMQConnectionChannel -> setup rabbit mq channel
func SetupRabbbitMQConnectionChannel() (*amqp.Connection, *amqp.Channel) {
//dial
url := fmt.Sprintf("amqp://%s:%s@%s:%s/", constants.USERNAME, constants.PASSWORD, constants.HOST, constants.PORT)
conn, err := amqp.Dial(url)
order {"id":4592779886789,"admin_graphql_api_id":"gid:\/\/shopify\/Order\/4592779886789","app_id":580111,"browser_ip":"209.152.96.166","buyer_accepts_marketing":false,"cancel_reason":null,"cancelled_at":null,"cart_token":"21517eef15cfeffec7793325f20a35f6","checkout_id":28856304074949,"checkout_token":"9e50530363383313809c40fa29225081","client_details":{"accept_language":"en-US,en;q=0.6","browser_height":null,"browser_ip":"209.152.96.166","browser_width":null,"session_hash":null,"user_agent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/107.0.0.0 Safari\/537.36"},"closed_at":null,"confirmed":true,"contact_email":null,"created_at":"2022-11-07T11:09:18-05:00","currency":"USD","current_subtotal_price":"5.15","current_subtotal_price_set":{"shop_money":{"amount":"5.15","currency_code":"USD"},"presentment_money":{"amount":"5.15","currency_code":"USD"}},"current_total_discounts":"0.00","current_total_discounts_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_
const memberColumns = useMemo(() => {
return [
{
Header: "Domain Name",
accessor: "name",
},
{
Header: "# of Records",
accessor: "number_of_records",
Cell: ({ value }) => {
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/outline";
import c from "classnames";
import { Fragment } from "react";
import Select from "react-select";
import {usePagination, useSortBy, useTable } from "react-table";
const sizeOptions = [10, 25, 50, 100].map((pageSize) => {
return {
value: pageSize,
label: "Show " + pageSize,
@dipeshhkc
dipeshhkc / jpg-to-webp.sh
Last active March 17, 2022 09:40
Bash Script to convert jpg image to webp
i=0
for img in *.(JPG|jpg);
do
echo "compressing i=$i"
cwebp $img -q 25 -o compressed/$i.webp
i=$((i+1))
done
@dipeshhkc
dipeshhkc / avatar-initial-names.tsx
Last active March 14, 2022 06:30
Avatar Using Name Initials in React and TailwindCSS
## Avatar Component
import { FC } from "react";
interface IAvatarInitials {
name: string;
}
export const AvatarInitials: FC<IAvatarInitials> = ({ name }) => {
const userName = name.split(" ");
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
'airbnb',
'airbnb-typescript',
'plugin:react/recommended',