Skip to content

Instantly share code, notes, and snippets.

View piyushchauhan2011's full-sized avatar
🔥
Working

Piyush Chauhan piyushchauhan2011

🔥
Working
View GitHub Profile
@piyushchauhan2011
piyushchauhan2011 / jwt.js
Last active February 17, 2024 00:14
Deno Google Sheets using google service accounts JWT authentication
const jwt = require("jsonwebtoken");
const credentials = require('./credentials.json');
const privateKey = credentials["private_key"];
const iss = credentials["client_email"];
const scope = "https://www.googleapis.com/auth/drive.readonly";
const token = jwt.sign(
{
@piyushchauhan2011
piyushchauhan2011 / api.http
Created April 8, 2020 15:39
Vscode Rest Client
@baseurl = https://api.spacexdata.com/v3
### Get Latest Launches
GET {{baseurl}}/launches/latest
### Get Upcoming Launches
GET {{baseurl}}/launches/upcoming
### Get Cores
# @name core
@piyushchauhan2011
piyushchauhan2011 / Knex-Migrations-Seeding.md
Created December 20, 2019 05:39 — forked from NigelEarle/Knex-Migrations-Seeding.md
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

@piyushchauhan2011
piyushchauhan2011 / main.c
Created December 4, 2019 09:05
C check mark and cross mark terminal unicode characters
#include <stdio.h>
#include <wchar.h>
#include <locale.h>
int main() {
setlocale(LC_CTYPE, "");
wchar_t checkMark = 0x2713;
wchar_t crossMark = 0x2717;
wprintf(L"%lc\n", checkMark);
wprintf(L"%lc\n", crossMark);
@piyushchauhan2011
piyushchauhan2011 / main.ts
Created November 25, 2019 09:46
IJK Tutorial
const isString = x => typeof x === "string";
const isArray = x => Array.isArray(x);
const isObject = x => typeof x === "object" && !isArray(x);
const clean = (arr, n) => (
n && Array.prototype.push.apply(arr, isString(n[0]) ? [n] : n), arr
);
const child = (n, cb) =>
n != null ? (isArray(n) ? n.reduce(clean, []).map(cb) : [n + ""]) : [];
@piyushchauhan2011
piyushchauhan2011 / index.html
Created November 25, 2019 06:19
Vanilla Hooks with Web Components
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Web Component Hooks</title>
</head>
<body>
<my-counter></my-counter>
@piyushchauhan2011
piyushchauhan2011 / nginx.conf
Created July 18, 2018 08:28 — forked from Stanback/nginx.conf
Example Nginx configuration for serving pre-rendered HTML from Javascript pages/apps using the Prerender Service (https://github.com/collectiveip/prerender).Instead of using try_files (which can cause unnecessary overhead on busy servers), you could check $uri for specific file extensions and set $prerender appropriately.
# Note (November 2016):
# This config is rather outdated and left here for historical reasons, please refer to prerender.io for the latest setup information
# Serving static html to Googlebot is now considered bad practice as you should be using the escaped fragment crawling protocol
server {
listen 80;
listen [::]:80;
server_name yourserver.com;
root /path/to/your/htdocs;
@piyushchauhan2011
piyushchauhan2011 / .babelrc
Created July 5, 2018 21:07 — forked from kristw/.babelrc
Configure rollup with lodash
{
"presets": ["es2015"]
}
package astar
import "container/heap"
type NodeQueue []Node
func NewNodeQueue() NodeQueue {
return make(NodeQueue, 0, 1000)
}
@piyushchauhan2011
piyushchauhan2011 / combinators.js
Created February 26, 2018 22:26 — forked from Avaq/combinators.js
Common combinators in JavaScript
const I = x => x;
const K = x => y => x;
const A = f => x => f(x);
const T = x => f => f(x);
const W = f => x => f(x)(x);
const C = f => y => x => f(x)(y);
const B = f => g => x => f(g(x));
const S = f => g => x => f(x)(g(x));
const P = f => g => x => y => f(g(x))(g(y));
const Y = f => (g => g(g))(g => f(x => g(g)(x)));