Skip to content

Instantly share code, notes, and snippets.

Sudarshan Gaikaiwari sudarshang

Block or report user

Report or block sudarshang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View parens.py
#!/usr/bin/env python3
"Generate all strings containing just ( and ) with parens balenced."
from itertools import count
def parens():
def nested(x):
return ("(" * x) + (")" * x) if x > 0 else ""
View minimal-analytics-snippet.js
(function (history, trackingId, options) {
const generateId = () => {
return '_' + Math.random().toString(36).substr(2, 9);
};
const getId = () => {
if (!localStorage.cid) {
localStorage.cid = generateId()
}
return localStorage.cid;
};
View trolley.py
INTERSECTIONS = ["A 2", "A 3", "A 6", "B 4", "B 5", "C 1", "C 3", "D 1", "D 2", "D 4"]
def Letter(intersection):
return intersection.split()[0]
def Number(intersection):
return intersection.split()[1]
@sudarshang
sudarshang / tutorial.md
Created Jul 17, 2018 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API
View tutorial.md

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

View Gatsby-bootstrap-lifecycle.md

Sequence of Gatsby's bootstrap lifecycle with links to source code as of v2.0.0

permalink https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c995c760fe380769852bcdb26a2278/packages/gatsby/src/bootstrap/index.js

  1. open and validate gatsby-config (get-config-file.js)
  2. load plugins (load-plugins/index.js) from the list given in gatsby-config.js
  3. onPreBootstrap: runs onPreBootstrap if it is implemented in any plugins, for example gatsby-plugin-typography. Receives handy [apiCallArgs](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c995c760fe380769852bcdb26a2278/packages/gatsby/src/util
View gatsby-node.js
//const webpack = require("webpack");
const _ = require("lodash");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const path = require("path");
const Promise = require("bluebird");
const createPaginatedPostsPages = require("./gatsby-actions/createPaginatedPostsPages.js");
const { createFilePath } = require(`gatsby-source-filesystem`);
exports.onCreateNode = ({ node, getNode, boundActionCreators }) => {
@sudarshang
sudarshang / static.config.js
Created May 20, 2018
react-static moo.do blog config.js (copy pasted from react-static slack)
View static.config.js
import webpack from 'webpack';
import React, { Component } from 'react';
import { reloadRoutes } from 'react-static/node';
import jdown from 'jdown';
import chokidar from 'chokidar';
import path, { dirname } from 'path';
import RSS from 'rss';
import fs from 'fs';
var isDev = process.env.REACT_STATIC_ENV === 'development';
View diff-master-webpack-4
7a8
> <link rel="preload" as="script" href="/bootstrap.474eaeba.js">
9,16c10,13
< "/templates/styles.65f7d673.js">
< <link rel="preload" as="script" href=
< "/templates/vendors~main.6810fa37.js">
< <link rel="preload" as="script" href="/main.b47b78f3.js">
< <link rel="preload" as="script" href=
< "/templates/src/containers/Home.e0dd5fbb.js">
< <link rel="preload" as="style" href="/styles.65f7d673.css">
View basic.webpack-4.index.html
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Linux version 5.6.0">
<meta charset="UTF-8">
<title data-react-helmet="true"></title>
<link rel="preload" as="script" href=
"/templates/styles.65f7d673.js">
<link rel="preload" as="script" href=
View basic.master.index.html
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Linux version 5.6.0">
<meta charset="UTF-8">
<title data-react-helmet="true"></title>
<link rel="preload" as="script" href="/bootstrap.474eaeba.js">
<link rel="preload" as="script" href=
"/templates/src/containers/Home.07880ce7.js">
You can’t perform that action at this time.