Skip to content

Instantly share code, notes, and snippets.

@bhavyaw
bhavyaw / asyncLoop.js
Last active March 16, 2016 06:35
Async For Loop
/**
* Class
*/
var AsyncLoop = function(list,fn,customDelay){
var listLength = list.length;
var i = 0;
var currentListItem = null;
var asyncDelay = customDelay || 0;
@bhavyaw
bhavyaw / umd-script-boilerplate.js
Created March 21, 2016 12:19 — forked from cferdinandi/umd-script-boilerplate.js
A simple boilerplate for UMD JS modules.
(function (root, factory) {
if ( typeof define === 'function' && define.amd ) {
define([], factory(root));
} else if ( typeof exports === 'object' ) {
module.exports = factory(root);
} else {
root.myPlugin = factory(root);
}
})(typeof global !== "undefined" ? global : this.window || this.global, function (root) {
@bhavyaw
bhavyaw / domHelper.js
Created March 21, 2016 12:55
domHelperMain.js
/**
* Helper Utilities
*/
//single element DOM utils
var DOM_UTILS = {
hasClass : function(element,className){
if(this.isElementObj(element)) return !!element.className.match(new RegExp('(\\s|^)'+className+'(\\s|$)'));
},
@bhavyaw
bhavyaw / objExtend.js
Last active August 11, 2018 20:53
Native JS Extend Functionality
/**
* Object Extending Functionality
*/
var extend = function(out) {
out = out || {};
for (var i = 1; i < arguments.length; i++) {
if (!arguments[i])
continue;
for (var key in arguments[i]) {
@bhavyaw
bhavyaw / GruntFile.js
Created April 14, 2016 11:42
simple grunt server config ( using grunt-contrib-connect )
connect: {
options: {
port: 9007,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729,
keepalive:true,
base: '.'
},
livereload: {
@bhavyaw
bhavyaw / equals.js
Created April 18, 2016 06:59
ngValueEqualsDirective ( used in confirm password )
(function(){
'use strict';
angular
.module('app')
.directive('equals',valueEquals);
function valueEquals(){
return {
  • AWS Simple Storage Service, e.g. S3, is a “highly durable and available store” and can be used to reliably store application content such as media files, static assets and user uploads. It allows you to offload your entire storage infrastructure and offers better scalability, reliability, and speed than just storing files on the filesystem.
What do i want in a editor?
1.) Emmet for html and sass
2.) Proper Documentation extension
3.) Solarized theme ( theme support )
4.) Javascript autocompletion
5.) Angular auto completion
6.) Snippets - html, sass, angular etc etc
7.) Git Integation ( Not necessary though )
8.) Alignment
@bhavyaw
bhavyaw / debouncer.js
Created June 4, 2016 14:41
Javascript Debounce Utilities
// Implementation
// run key up event handler as debounced key down handlers
var
_debounceTimeout; // key debouncer required params
// Usage
debounceStart(function(){
// Function which is to be debounced
});
1.) We can't access private members in methods that are added to the object at a later point.
2.) Writing Unit Tests for Private Functions