Skip to content

Instantly share code, notes, and snippets.

View kevjose's full-sized avatar
👨‍💻
zinging

kevin kevjose

👨‍💻
zinging
View GitHub Profile

Intro to containers

  • to the core containers are few features of linux kernel duct taped together to acheive isolation.

Need for containers

Bare metals

  • to run a web server or a service, had to own or rent out physical server
  • no abstraction, tedious to set up and running
@kevjose
kevjose / nginx.conf
Created May 4, 2018 09:05 — forked from Unitech/nginx.conf
NGINX/PM2
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
Array.prototype.swap = function(i, j){
var temp = this[i];
this[i] = this[j];
this[j] = temp;
}
Array.prototype.bubbleSort = function(){
var swapped;
do{
swapped = false;
function CreateEventBus () {
this._listeners = {} // to store the events key being the event name and value being the function to be called
}
CreateEventBus.prototype = {
constructor: CreateEventBus,
on: function(type, listener) {
if(this._listeners[type] === undefined){
this._listeners[type] = []; // to handle multiple funcitons on the same event
}
getCurrentFiscalYear(y) {
//get current date
var today = new Date(y);
//get current month
var curMonth = today.getMonth();
var fiscalYr = "";
if (curMonth > 3) { //
var nextYr1 = (today.getFullYear() + 1).toString();
function MyConstructor(data, transport) {
this.data = data;
transport.on('data', function () {
alert(this.data);
});
}
// Mock transport object
var transport = {
on: function(event, callback) {
var user = {
place:'India',
data:[
{name:'John', age:20},
{name:'Jane', age:18}
],
clickHandler: function(){
var usr = this;
this.data.forEach(d){
console.log(d.name, usr.place);
var user = {
place:'India',
data:[
{name:'John', age:20},
{name:'Jane', age:18}
],
clickHandler: function(){
this.data.forEach(d){
console.log(d.name, this.place);
}
var data = {
name:'John',
age: 20
}
var user = {
data: {
name:'Jane',
age: 18
},
showData = function(){
var ControllerA = {
scores :[1, 2, 3, 4],
avgScore:null
}
var ControllerB = {
scores :[5, 6, 7, 8, 9],
avgScore:null,
avg:function () {
var sumOfScores = this.scores.reduce (function (prev, cur, index, array) {
return prev + cur;