Skip to content

Instantly share code, notes, and snippets.

View Shahzad6077's full-sized avatar
🔥
Focusing

Muhammad Shahzad Ali Shahzad6077

🔥
Focusing
View GitHub Profile
@reksamamur
reksamamur / MultiNestedField.tsx
Last active September 5, 2022 02:34
Multi Nested Field Array using react-hook-form
import "./styles.css";
import {
useForm,
FormProvider,
useFormContext,
useFieldArray,
UseFieldArrayReturn
} from "react-hook-form";
import { useImperativeHandle, useRef, forwardRef } from "react";
import { useScroll } from 'framer-motion';
const Navbar = () => {
const scroll = useScroll();
const [timeRemaining, setTimeRemaining] = React.useState(readTime);
React.useEffect(() => {
return scroll.scrollYProgress.onChange((progress) => {
setTimeRemaining(Math.floor(readTime * (1 - progress)));
});
@carlssonk
carlssonk / deploy_node_do.md
Last active February 18, 2024 16:38
Deploy node.js app to DigitalOcean

Deploy Node.js Application to DigitalOcean

This step by step tutorial will show you how to set up a Node.js server with MongoDB to DigitalOcean using PM2, NGINX as reverse proxy and a SSL from LetsEncrypt. We will also add a custom domain name.

Prerequisites

Create Droplet & Generate SSH Key

@eladnava
eladnava / server.js
Created November 13, 2020 04:28
Get Facebook Ads Lead Notifications in Realtime with Node.js
const axios = require('axios');
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const port = 3000;
// Enter the Page Access Token from the previous step
const FACEBOOK_PAGE_ACCESS_TOKEN = '_______________________________';
@Pacheco95
Pacheco95 / AvatarUpload.js
Created October 24, 2020 04:58
Example of avatar uploading with React.js, Material UI and Styled Components
import { Avatar, Button as MuiButton, Typography } from "@material-ui/core";
import { grey } from "@material-ui/core/colors";
import {
CloudUpload as MuiCloudUpload,
Delete as MuiDelete,
} from "@material-ui/icons";
import { spacing } from "@material-ui/system";
import React, { createRef, useState } from "react";
import styled from "styled-components";
@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active July 24, 2024 12:24
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@nguyenvanduocit
nguyenvanduocit / pwa-install-button.js
Created November 6, 2019 02:21
Install PWA Button
export default () => {
//*** Determine whether or not the PWA has been installed. ***//
// Step 1: Check local storage
let pwaInstalled = localStorage.getItem('pwaInstalled') === 'yes';
// Step 2: Check if the display-mode is standalone. (Only permitted for PWAs.)
if (!pwaInstalled && window.matchMedia('(display-mode: standalone)').matches) {
localStorage.setItem('pwaInstalled', 'yes');
pwaInstalled = true;
@victorbruce
victorbruce / Firebase.md
Last active March 12, 2024 12:07
My journey with Firebase so far. Cheatsheet to serve as a quick reference when developing firebase applications

Firebase

Set up firebase and Deploy

  • Head over to firebase. Sign in and create a project.

  • Copy your project settings under Firebase SDK snippet into your local project (ie your project's api key, auth domain, databaseURL, etc)

  • Create a file (firebase.js or config.js Any name that suits you is fine)

@MyCueCards
MyCueCards / AMPScript_URL_Concat.html
Created October 3, 2018 13:58
In a Salesforce Marketing Cloud email, this builds a URL when using a Google Campaign URL. This includes a couple static parameters and then a field from the sendable data extension.
%%[Set @url = concat('https://www.someurl.com?utm_source=StaticParameter1&utm_medium=StaticParameter2&utm_campaign=StaticParameter3&utm_term=',FieldName,'&utm_content=StaticParameter4')]%%
<a href="%%=RedirectTo(v(@url))=%%" target="_blank" style="font-size: 18px; font-family: Open Sans, Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; border-radius: 5px; background-color: #000000; padding: 15px 30px; border: 1px solid #000000; display: block;">Click Here &#187;</a>
@jeremysears
jeremysears / gremlin-cheat-sheet.md
Last active April 26, 2024 08:35
Gremlin Cheat Sheet in Groovy

Gremlin Cheat Sheet in Groovy

Gremin traversal examples taken from the excellent DS330: DataStax Enterprise Graph course.

Creating Vertices and Vertex Properties

Add a Vertex

Vertex u = graph.addVertex("user");
       u.property("userId","u2016");
 u.property("age",36);