Skip to content

Instantly share code, notes, and snippets.

View srijan1709's full-sized avatar

Srijan srijan1709

View GitHub Profile
const MyContext = React.createContext(defaultValue); // creates a context object
/* A component who will subscribe to the above context will read the current
context value from the closest matching Provider when React renders the component. */
/* The defaultValue argument is only used when a component does not have a matching
Provider above it in the tree. */
<MyContext.Provider value={/* some value */}>
@srijan1709
srijan1709 / index.js
Created March 1, 2020 11:54 — forked from JaySunSyn/index.js
Firebase functions Dynamic OG-Tags
exports.host = functions.https.onRequest((req, res) => {
const userAgent = req.headers['user-agent'].toLowerCase();
let indexHTML = fs.readFileSync('./hosting/index.html').toString();
const path = req.path ? req.path.split('/') : req.path;
const ogPlaceholder = '<meta name="functions-insert-dynamic-og">';
const metaPlaceholder = '<meta name="functions-insert-dynamic-meta">';
const isBot = userAgent.includes('googlebot') ||
userAgent.includes('yahoou') ||
userAgent.includes('bingbot') ||
@srijan1709
srijan1709 / react-terminology.md
Created February 27, 2020 03:47 — forked from sebmarkbage/react-terminology.md
React (Virtual) DOM Terminology
@srijan1709
srijan1709 / README.md
Created November 21, 2019 19:58 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@srijan1709
srijan1709 / pre-commit.sh
Created August 11, 2019 17:35 — forked from dahjelle/pre-commit.sh
Pre-commit hook for eslint, linting *only* staged changes.
#!/bin/bash
for file in $(git diff --cached --name-only | grep -E '\.(js|jsx)$')
do
git show ":$file" | node_modules/.bin/eslint --stdin --stdin-filename "$file" # we only want to lint the staged changes, not any un-staged changes
if [ $? -ne 0 ]; then
echo "ESLint failed on staged file '$file'. Please check your code and try again. You can run ESLint manually via npm run eslint."
exit 1 # exit with failure status
fi
done
@srijan1709
srijan1709 / pre-commit-eslint
Created August 11, 2019 04:09 — forked from shettayyy/pre-commit-eslint
Pre-commit hook for Linting JS with ESLint before commit.
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint"
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
@srijan1709
srijan1709 / index.html
Last active August 10, 2018 15:31
index.html for profile card example
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./css/style.css" />
</head>
<body>
<div id="container">
<div id="card">
<img src="./john_doe.png" class="img-profile" alt="profile pic"/>
<p>John Doe</p>
@srijan1709
srijan1709 / apps.js
Created July 17, 2018 08:35 — forked from eliOcs/apps.js
Express and Handlebars
/*jslint node: true */
"use strict";
var express = require("express"),
consolidate = require("consolidate"),
Handlebars = require("handlebars"),
fs = require("fs");
var app = express();
@srijan1709
srijan1709 / test.ext
Created July 9, 2018 18:23
Test Gist
Test