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
/** | |
* @file file-input.component.js | |
* @author Miroslav Georgiev | |
* @version 0.0.1 | |
*/ | |
(function () { | |
'use strict'; | |
/** |
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
<td ng-bind="(($index + 1) + (paginationOptions.currentPage - 1) * paginationOptions.itemsPerPage)"></td> |
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
<!-- using CSS --> | |
<head> | |
<style> | |
.my-disabled-link { | |
cursor: default; | |
pointer-events: none; | |
} | |
</style> | |
</head> | |
<body> |
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
git rm --cached file-name.txt | |
git rm -r --cached folder-name | |
git commit -m "removed file-name and/or folder-name" | |
git push origin master or branch-name |
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
// code from | |
// http://stackoverflow.com/questions/15854425/iterate-over-a-javascript-array-without-using-nested-for-loops/15854485#15854485 | |
function printArray(arr) { | |
for (var i = 0; i < arr.length; i++) { | |
if (Array.isArray(arr[i])) { | |
printArray(arr[i]); | |
} else { | |
console.log(arr[i]); | |
} |
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
// from https://www.sitepoint.com/sort-an-array-of-objects-in-javascript/ | |
function compareValues(key, order='asc') { | |
return function(a, b) { | |
if(!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) { | |
return 0; | |
} | |
const valA = (typeof a[key] === 'string') ? a[key].toUpperCase() : a[key]; | |
const valB = (typeof b[key] === 'string') ? b[key].toUpperCase() : b[key]; | |
let comparison = 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
// date format: 'YYYY-MM-dd' | |
var RegExp = /^(199\\d)|([2-9]\\d{3})-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/; | |
// date format: 'MM/dd/YYYY', | |
RegExp = /^(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$/; | |
// passed as a string | |
var regexp = new RegExp('^(0[1-9]|1[0-2])\/(0[1-9]|1\\d|2\\d|3[01])\/(19|20)\\d{2}$'); |
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
// 1d array | |
for (var i = 0, len = arr.length; i < len; i++) { | |
if (somevalue < arr[i]) { | |
arr.splice(i, 0, somevalue); | |
break; | |
} | |
} | |
return arr; |
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
function SaveFileCtrl (SaveFileService) { | |
var vm = this; | |
function downloadFile(someArgument) { | |
SaveFileService.downloadFile({ | |
param: someArgument | |
}, function (response) { | |
var fileName = response.headers['content-disposition'].split("=")[1].replace(/\"/gi,''); | |
var fileType = response.headers['content-type'] + ';charset=utf-8'; | |
var blob = new Blob([response.data], { type: fileType }); |
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'; | |
/** | |
* @method flattenArray | |
* @description A method to convert multi dimensional arrays to 1D arrays | |
* @param {Array} arr - The multi D array that needs to be flattened (converted to 1D) | |
* @param {String} [key] - An object key that will be used to flatten an array of | |
* nested objects (e.g. "[ { key: [ val1, val2, ..., valN ] }, { key: [ val1, val2, ..., valN ] } ]") | |
* @param {Boolean} [remove] - Flag to indicate whether or not to delete object's children if | |
* they are not need it after flattening (e.g. if true, will remove "key: [ val1, val2, ..., valN ]" after it is being flattened) |
OlderNewer