Skip to content

Instantly share code, notes, and snippets.

View addityasingh's full-sized avatar
💻
Focusing

Aditya Pratap Singh addityasingh

💻
Focusing
View GitHub Profile
@addityasingh
addityasingh / graphql.md
Created June 13, 2019 15:20
Notes from LeadDevLondon conference

Conversation with use of Graphql at twitter

  • They are doing it gradually
  • They use Noun instead of Entity to name the graphql entities
  • So far migrated User and Tweet nouns
  • Struggled with de-duplicating response
  • Plan is to migrate gradually
  • They use Strato, their internal technology for virtual federated database, to power all graphql queries by plugging Strato with FB's Thrift services which provides them type safety
import {foo, bar} from '../foo-bar';
import * as abc from '../util'
import * as https from 'https'
describe("asdf", () => {
test("foo", async () => {
jest.spyOn(https, 'request').mockImplementation(() => jest.fn() as any);
await foo('https://example.org');
expect(https.request).toHaveBeenCalledWith('https://example.org');
})
(function () {
'use strict';
angular
.module('app', [])
.config(config);
config.$inject = ['$provide'];
function config($provide) {
@addityasingh
addityasingh / RUST-cheatsheet.md
Last active May 29, 2018 14:11
RUST cheatsheet

RUSTUP

  • How to install toolchain?
rustup toolchain install nightly
  • How to uninstall toolchain?
@addityasingh
addityasingh / ContinuosDeployment.md
Created August 17, 2017 12:13
Continuous deployment
  • Canary Deployments: Route a subset of users to new version as part of CD process. We can leverage it for AB test and Perf testing. As an advanatge we already have RC environment. We can make it default for internal live/ combine it with Octopus-Skipper setup to put very small weights of live users and create monitors to measure exact targeted KPIs Depending on the KPI numbers we can either make it live version or roll it back. This will allow faster deployment cycle with better quality and confidence We can use the information about rollout or rollbacks as a feedback to improve the process in future https://www.infoq.com/news/2013/03/canary-release-improve-quality
@addityasingh
addityasingh / notes.md
Created July 20, 2017 13:52
ES modules: Development by TC39 and other details
@addityasingh
addityasingh / docker-utility.md
Last active February 18, 2019 16:50
Docker cheatsheet

Basic commands

// Run docker image in interactive mode
docker run -it <image name>:<image tag>  

// Run docker image in interactive mode with host port 8080 mapped to container port 80
docker run -it -p 8080:80 <image name>:<image tag> 

// Run docker with the 3001 port exposed, 
docker run -it --expose=3001 <image name>:<image tag>
@addityasingh
addityasingh / forEach.js
Last active May 14, 2016 14:40
Pure functions using ES2015 to create common utilities
function forEach(arr, callback, start=0) {
if (0 < start && start < arr.length) {
callback(arr[start], start, arr);
return forEach(arr, callback, start + 1);
}
}
@addityasingh
addityasingh / findKey.js
Last active January 15, 2017 23:24
Equivalent pure functions for Functional programming utility functions like .map(), .filter() in ES2015
/**
* A pure function to find key from object, matching a predicate
* similar to https://lodash.com/docs/4.17.4#findKey or Array.findIndex()
* @param {Object} obj: The object to find the specified key from
* @param {Function} fn: The predicate function
*/
const findKey = (obj, fn) => Object.keys(obj).find(k => fn(obj[k]));
//Test code