This file contains hidden or 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
| app.directive('ensureUnique', ['$http', function ($http) { | |
| return { | |
| require: 'ngModel', | |
| link: function (scope, ele, attrs, c) { | |
| scope.$watch(attrs.ngModel, function () { | |
| if(scope[attrs.ngModel] !== undefined) { | |
| $http({ | |
| method: 'POST', |
This file contains hidden or 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
| app.directive('decimalOnly', function () { | |
| return { | |
| require: 'ngModel', | |
| link: function (scope, element, attrs, modelCtrl) { | |
| modelCtrl.$parsers.push(function (inputValue) { | |
| if (inputValue == undefined) return '' | |
| console.log(inputValue) | |
| var transformedInput = inputValue.replace(/[^0-9\\.]/g, ''); | |
| if (transformedInput != inputValue) { |
This file contains hidden or 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 createUser = function(userId, callback) { | |
| getLevelIds(userId, function(arr){ | |
| console.log(userId , arr , 'test') | |
| userId = arr | |
| callback(); | |
| }) | |
| } | |
| async.times(2, function(n, next){ | |
| createUser(userId, function(err, user) { |
This file contains hidden or 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
| # Install linux update, followed by GCC and Make | |
| sudo yum -y update | |
| sudo yum install -y gcc make | |
| # Install Nginx and PHP-FPM | |
| sudo yum install -y nginx php-fpm | |
| # Install PHP extensions | |
| sudo yum install -y php-devel php-mysql php-pdo \ | |
| php-pear php-mbstring php-cli php-odbc \ |
This file contains hidden or 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
| jQuery(document).ready(function(){ | |
| setTimeout(function(){ | |
| jQuery.fn.simulateClick = function() { | |
| return this.each(function() { | |
| if('createEvent' in document) { | |
| var doc = this.ownerDocument, | |
| evt = doc.createEvent('MouseEvents'); |
This file contains hidden or 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
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> | |
| <link rel="stylesheet" type="text/css" href="components/bootstrap-daterangepicker/daterangepicker-bs3.css"> | |
| <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
| <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script> | |
| <script type="text/javascript" src="https://raw.githubusercontent.com/dangrossman/bootstrap-daterangepicker/master/moment.js"></script> |
This file contains hidden or 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
| res.locals.titleGenerator = function () { | |
| var urlPath = (req.route.path).split('/') | |
| var urlName = urlPath[1]; | |
| function capitalizeEachWord(str) { | |
| return str.replace(/\w\S*/g, function (txt) { | |
| return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); | |
| }); | |
| } |
This file contains hidden or 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 validUrl = require('valid-url'); | |
| if(validUrl.isUri(imageUrl)){ | |
| request | |
| .get(imageUrl) | |
| .on('response', function (response) { | |
| console.log(response.statusCode) | |
| imagesName = (imagesName.split('?')[0]) | |
| if (response.statusCode == 200) { |
This file contains hidden or 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 rejectFolders = ['css', 'bower_components' , 'js', 'fonts' , 'assets'] | |
| app.use(morgan('tiny', { | |
| skip: function (req, res) { | |
| if(rejectFolders.indexOf(req.url.split('/')[1]) != -1 ){ | |
| return true | |
| } else { | |
| return false | |
| } |
This file contains hidden or 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
| app.directive('autofit', function(){ | |
| return function(scope, element, attrs){ | |
| var span = element.find('span:visible:first'); | |
| var maxHeight = element.height(); | |
| var maxWidth = element.width(); | |
| var originalFontSize = parseInt(element.css('font-size').replace('px',''),10); |
OlderNewer