adonis install adonis-acl
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
/** | |
In a game, there is a string, direction, of length n that consists of characters | |
L and R. | |
L denotes left. R denotes right, and there is a line segment of | |
length 2" that extends from [0, 2"], a player takes n turns. | |
In the th turn, | |
• The player places the number i at the center of the current line segment. | |
• If direction[i] = L; the player proceeds in the left direction, eliminating the right half of the current line segment, | |
and vice versa for direction[i] = 'R'. | |
Following this rule, find the final order of numbers on the line segment, |
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
static getUniqueArrayListBy(arr, key) { | |
return [...new Map(arr.map((item) => [item[key], item])).values()]; | |
} |
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
const arr = ['a','b', 'c', 'd','x', 'y', 'z']; | |
function findMe(target, start, end) { | |
if (start > end) return 'not found'; | |
const middle = Math.floor((start+end)/2); | |
if (arr[middle] === target) { | |
return `found it at index ${middle}`; | |
} |
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 one-liner to calculate total minesweeper neighbours | |
// Polyfill for ECMA 2019 | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat | |
if (!Array.prototype.flat) { | |
Array.prototype.flat = function () { | |
return this.reduce((acc, val) => acc.concat(val), []); | |
} | |
} |
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
export default function flatten(arr) { | |
return arr.reduce((flat, toFlatten) => { | |
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten); | |
}, []); | |
} | |
// Test | |
flatten([[1,2,[3]],4]); |
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
/* | |
##Device = Desktops | |
##Screen = 1281px to higher resolution desktops | |
*/ | |
@media (min-width: 1281px) { | |
//CSS | |
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
## cmd vim /etc/nginx/sites-available/default | |
upstream node { | |
server 127.0.0.1:8080; | |
keepalive 64; | |
} | |
server { | |
listen 80; | |
# server_name domain.com; |
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
/** | |
* @ngdoc directive | |
* @name radioTabbable | |
* @requires none | |
* @description | |
* Makes individual radio buttons focuseable using the TAB key. | |
* (By default, pressing TAB while on a radio button would have shifted focus to the next control outside of the radio group.) | |
* @usage | |
* <input type="radio" name="radioGroup" value="0" radio-tabbable="" /> | |
* <input type="radio" name="radioGroup" value="1" radio-tabbable="" /> |
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
# robots.txt for Magento 1.9.x / v1.6 2018-08-19 / Peeter Marvet | |
# (original version from 2015, edited in 2017 to add filter query parameter disallow samples + some wildcards, | |
# edited in 2018 to add query params blocking to Yandex as named User-agent does not read *) | |
# based on: | |
# http://inchoo.net/ecommerce/ultimate-magento-robots-txt-file-examples/ | |
# http://www.byte.nl/blog/magento-robots-txt/ | |
# https://astrio.net/blog/optimize-robots-txt-for-magento/ | |
# | |
# comment and clone at https://gist.github.com/petskratt/016c9dbf159a81b9d6aa | |
# Keep in mind that by standard robots.txt should NOT contain empty lines, except between UA blocks! |
NewerOlder