Skip to content

Instantly share code, notes, and snippets.

View mandeepm91's full-sized avatar

Mandeep Singh Gulati mandeepm91

View GitHub Profile
(function () {
if ( typeof window.CustomEvent === "function" ) return false;
function CustomEvent ( event, params ) {
params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt = document.createEvent( 'CustomEvent' );
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
return evt;
}
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent;
{
"url": "http://localhost/v1/api-docs",
"apisSorter": "alpha",
"displayOperationId": true
}
@mandeepm91
mandeepm91 / list-all-objects-from-an-s3-bucket.js
Created April 15, 2018 12:13
Lists all objects from an S3 bucket
/*
AWS SDK for Node.js provides the s3.listObjects API which
lists the objects from a bucket. However, if you have a lot
of objects in your bucket then the response of this API is
truncated. So, the entire contents of a bucket cannot be
fetched in a single API call and you need to call the API
multiple times, each time passing a `marker` parameter which
is the `Key` of the last element of the previous response.
This gist is demonstrating the same. This script uses async/await
feature of the Node.js so make sure you have the appropirate
@mandeepm91
mandeepm91 / server.js
Created November 27, 2017 16:39
Basic chatroom server using Node.js
// run the server using `node server.js` command
// connect to the server using `nc <IP address> 8080`
const server = require('net').createServer();
let sockets = {};
let counter = 1;
function timestamp () {
const now = new Date();
@mandeepm91
mandeepm91 / app.js
Created August 6, 2016 09:58 — forked from rnkoaa/app.js
A simple angularjs with angular-ui modal form which includes validation on the client side. Thanks http://scotch.io/tutorials/javascript/angularjs-form-validation
var app = angular.module("modalFormApp", ['ui.bootstrap']);
app.controller("modalAccountFormController", ['$scope', '$modal', '$log',
function ($scope, $modal, $log) {
$scope.showForm = function () {
$scope.message = "Show Form Button Clicked";
console.log($scope.message);
var modalInstance = $modal.open({