Skip to content

Instantly share code, notes, and snippets.

View vinaypuppal's full-sized avatar
🤓
Working from home

vínαч puppαl vinaypuppal

🤓
Working from home
View GitHub Profile
@vinaypuppal
vinaypuppal / nested-fql-template.js
Created April 8, 2020 21:19 — forked from ptpaterson/nested-fql-manual.js
Template for building deeply nested FQL queries for FaunaDB
const baseQuery = q.Paginate(q.Match(q.Index(indexName), terms));
// or
// const baseQuery = q.Paginate(q.Collection(collectionName))
const expandedQuery = q.Map(baseQuery, (ref) =>
q.Let(
{
instance: q.Get(q.Var('ref'))
},
{
@vinaypuppal
vinaypuppal / machine.js
Created November 9, 2019 03:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
version: "3.7"
services:
mongo:
image: mongo:latest
ports:
- "27017:27017"
volumes:
- mongo-vol:/var/lib/mongo/data
networks:
@vinaypuppal
vinaypuppal / index.html
Created August 20, 2018 04:45
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@vinaypuppal
vinaypuppal / index.html
Created August 20, 2018 04:28
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@vinaypuppal
vinaypuppal / readme.md
Last active November 22, 2017 07:07
GITHUB_OAUTH
  • On Frontend
    • User clicks Login With Github Button.
    • We redirect user to https://github.com/login/oauth/authorize with client_id, redirect_uri and scope as query params.
    • Example
      https://github.com/login/oauth/authorize?scope=user:email&client_id=<CLIENT_ID>&state=<state>
      
    • Once user allows access github redirect back us to supplied redirect_uri with code as query parameter.
    • Example
@vinaypuppal
vinaypuppal / fonts.css
Created August 2, 2017 10:48
UI System fonts in web
body {
font-family:
/* 1 */ -apple-system, BlinkMacSystemFont,
/* 2 */ "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
/* 3 */ "Helvetica Neue", sans-serif;
}
@vinaypuppal
vinaypuppal / LinkSmoothScroll.js
Last active March 17, 2022 19:10
Next.js smooth scroll
import React, { Children } from 'react'
import Router from 'next/router'
import smoothScroll from '../utils/smoothScroll'
// this HOC is taken from https://github.com/zeit/next.js/blob/master/lib/link.js and modified
export default class LinkSmoothScroll extends React.Component {
constructor (props) {
super(props)
this.linkClicked = this.linkClicked.bind(this)
}

Keybase proof

I hereby claim:

  • I am vinaypuppal on github.
  • I am vinaypuppal (https://keybase.io/vinaypuppal) on keybase.
  • I have a public key whose fingerprint is 555A D17F 3449 6347 B255 599F 40B2 391F C2D9 8337

To claim this, I am signing this object:

@vinaypuppal
vinaypuppal / JSON_to_URLEncoded.js
Created September 30, 2016 21:20 — forked from lastguest/JSON_to_URLEncoded.js
Convert JavaScript object to x-www-form-urlencoded format
function JSON_to_URLEncoded(element,key,list){
var list = list || [];
if(typeof(element)=='object'){
for (var idx in element)
JSON_to_URLEncoded(element[idx],key?key+'['+idx+']':idx,list);
} else {
list.push(key+'='+encodeURIComponent(element));
}
return list.join('&');
}