This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.filter('unique', function () { | |
return function (items, filterOn) { | |
if (filterOn === false) { | |
return items; | |
} | |
if ((filterOn || angular.isUndefined(filterOn)) && angular.isArray(items)) { | |
var hashCheck = {}, newItems = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
usage: | |
Initializer.mapsInitialized.then(function(){ | |
initMap(); // do stuff with maps | |
}); | |
*/ | |
angular.module('ngApp', []). | |
factory('Initializer', function($window,$q){ | |
var asyncUrl = '//maps.googleapis.com/maps/api/js?callback=', | |
mapsDefer = $q.defer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.directive('onlyAlpha', function(){ | |
return { | |
require: 'ngModel', | |
link: function(scope, element, attrs, modelCtrl) { | |
modelCtrl.$parsers.push(function (inputValue) { | |
if (inputValue == undefined) return ''; | |
var transformedInput = inputValue.replace(/[\W_]+/g,'').toUpperCase(); | |
if (transformedInput!=inputValue) { | |
modelCtrl.$setViewValue(transformedInput); | |
modelCtrl.$render(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form class="form-horizontal" name="chkForm" method="post" action="/this/is/an/action/" ng-submit="processThis(chkForm.$valid,$event)" novalidate> | |
/* the processThis function fires before the form action submits so we can hijack it. Passing $event allows for event.preventDefault() to be used | |
in the function in order to stop the form posting. https://docs.angularjs.org/api/ng/directive/ngSubmit | |
*/ | |
</form> | |
//in controller | |
$scope.processThis = function(isValid,e) { | |
if(isValid) { | |
e.preventDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lang = navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Add ECMA262-5 method binding if not supported natively | |
// | |
if (!('bind' in Function.prototype)) { | |
Function.prototype.bind= function(owner) { | |
var that= this; | |
if (arguments.length<=1) { | |
return function() { | |
return that.apply(owner, arguments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:%20{var%20d=window.location.hostname;var%20h=d.split('.');var%20x=h[1]+'.'+h[2];document.activeElement.value='fuckoff@'+x;void(0)}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
moment().utc().format('YYYY-MM-DD[T]HH:mm:ss[Z]').toString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
mutha f**king angular-google-maps | |
http://angular-ui.github.io/angular-google-maps/#!/api | |
*/ | |
$scope.findSquare = function(index) { | |
var boundaryLatLng = new google.maps.LatLngBounds(), | |
thisBounds = []; | |
// or do a forEach here for multiples | |
thisBounds.push( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.paulirish.com/2009/random-hex-color-code-snippets/ | |
'#'+('000000' + Math.floor(Math.random()*16777215).toString(16)).slice(-6) |