Skip to content

Instantly share code, notes, and snippets.

@mir4ef
mir4ef / loop-multi-d-arrays.js
Created July 5, 2016 14:08
Recursive loop over multi dimensional arrays in JavaScript
// 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]);
}
@mir4ef
mir4ef / git-remove
Created June 30, 2016 17:59
Remove a file/folder from git repo, but keep local
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
@mir4ef
mir4ef / disable-anchor-tag.html
Last active June 30, 2016 11:45
Disable anchor tag with either css or javascript
<!-- using CSS -->
<head>
<style>
.my-disabled-link {
cursor: default;
pointer-events: none;
}
</style>
</head>
<body>
@mir4ef
mir4ef / calc-row-number.html
Last active June 30, 2016 11:45
Calculate row number when using pagination
<td ng-bind="(($index + 1) + (paginationOptions.currentPage - 1) * paginationOptions.itemsPerPage)"></td>
@mir4ef
mir4ef / file-input.component.js
Last active June 30, 2016 11:45
Capture a file from input type='file' with AngularJS
/**
* @file file-input.component.js
* @author Miroslav Georgiev
* @version 0.0.1
*/
(function () {
'use strict';
/**