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 / build-ios.sh
Last active April 1, 2016 21:07
Setup phonegap-push-plugin for ionic app
$PATH_TO_PROVISIONING_PROFILE = ""
$DEVELOPER_TEAM_ID = ""
xcodebuild PROVISIONING_PROFILE="$PATH_TO_PROVISIONING_PROFILE" CODE_SIGN_IDENTITY="$DEVELOPER_TEAM_ID"
@addityasingh
addityasingh / try-catch-block-scope.js
Last active April 10, 2016 19:44
Try catch do not introduce block scope for new declarations
(function () {
'use strict';
try {
undefined();
} catch (err) {
var a = 5;
console.log(a); // 5
console.log(err); // TypeError: undefined is not a function(…)
}
@addityasingh
addityasingh / callback-hoisting.js
Created April 10, 2016 20:21
In JavaScript, are named callback functions hoisted?
function enclosingScope () {
var b;
function inner (def) {
def();
}
var a = 2;
}
// After hoisting due to compilation, the above changes to
@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
@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 / 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 / notes.md
Created July 20, 2017 13:52
ES modules: Development by TC39 and other details
@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 / 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?