Skip to content

Instantly share code, notes, and snippets.

@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 {
@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 / 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 / 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 / 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 / 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;