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
    
  
  
    
  | const getParsedQueenPosition = queenPosition => queenPosition.replace('(', '').replace(')', '').split(','); | |
| const getDiagnolAttackPositions = ({ position: queenPosition, rowIncrement, colIncrement }) => { | |
| const diagnolAttackPositions = {} | |
| const position = getParsedQueenPosition(queenPosition); | |
| const reviseRowPosition = currPosition => parseInt(currPosition) + (rowIncrement ? 1 : -1) | |
| const reviseColPosition = currPosition => parseInt(currPosition) + (colIncrement ? 1 : -1) | |
| let nextRowPosition = reviseRowPosition(position[0]); | |
| let nextColPosition = reviseColPosition(position[1]); | |
| isValidPosition = (rowPosition, colPosition) => { | 
  
    
      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
    
  
  
    
  | const numbersList = [3, 6, 2, 99, 32, 5, 89, 32]; | |
| Array.prototype.findHighestNumber = function(currentIndex = 1, lastHighestNumber = this[0]) { | |
| const currentNumber = this[currentIndex]; | |
| lastHighestNumber = lastHighestNumber > currentNumber ? lastHighestNumber : currentNumber; | |
| if (currentIndex === this.length - 1) { | |
| return lastHighestNumber; | |
| } | |
| const nextIndex = currentIndex + 1; | |
| return this.findHighestNumber(nextIndex, lastHighestNumber); | |
| } | 
  
    
      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
    
  
  
    
  | const getChocolates = (amount, price) => Math.floor(amount/price); | |
| const getChocolatesExchangedCount = (chocolates, wrapperExchangeRate, totalExchangedChocolates = 0) => { | |
| const exchangedChocolates = Math.floor(chocolates/wrapperExchangeRate); | |
| const remainingChocolates = chocolates%wrapperExchangeRate; | |
| const totalRemainingChocolates = exchangedChocolates + remainingChocolates | |
| totalExchangedChocolates += exchangedChocolates; | |
| if (totalRemainingChocolates < wrapperExchangeRate) { | |
| return totalExchangedChocolates; | |
| } | 
  
    
      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
    
  
  
    
  | String.prototype.getHighestRepeatingChar = function() { | |
| const charCountHash = {} | |
| let highestOccurence = 0; | |
| let highestRepeatingChar; | |
| for (let charIndex = 0; charIndex < this.length; charIndex++) { | |
| const currentChar = this[charIndex] | |
| const prevCharCount = charCountHash[currentChar] || 0 | |
| const currentCharCount = prevCharCount + 1; | |
| charCountHash[currentChar] = currentCharCount; | |
| if (highestOccurence === 0) { | 
  
    
      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
    
  
  
    
  | String.prototype.isPalindrome = function(charIndex = 0) { | |
| const stringLength = this.length; | |
| const charIndexFromBehind = stringLength - charIndex - 1; | |
| const isCharSame = this[charIndex] === this[charIndexFromBehind]; | |
| if (!isCharSame) { | |
| return false; | |
| } | |
| const isIndexSame = charIndex === charIndexFromBehind; | |
| if (isIndexSame) { | |
| return true; | 
  
    
      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
    
  
  
    
  | #!/bin/bash | |
| AWS_S3_LS='s3://<your-bucket-name-here/<prefix-optional>' | |
| SYS_DAY=$(date '+%d') | |
| SYS_MONTH=$(date '+%m') | |
| SYS_YEAR=$(date '+%Y') | |
| DEFAULT_TIME_AFTER="00:00:00" | |
| DEFAULT_TIME_BEFORE="23:59:59" | |
| SORT_DATE=true | |
| LOG_TYPE='out' | 
  
    
      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
    
  
  
    
  | aws s3api list-objects-v2 \ | |
| --bucket <bucket-name-here> \ | |
| --max-keys=5 \ | |
| --query "sort_by(Contents, &LastModified)[*].{Key:Key,Size:Size,LastModified:LastModified}" | |
| --query "reverse(sort_by(Contents,&LastModified))" \ | |
| --query "Contents[?contains(Key, '<file-name-here>')]" | |
| --query "Contents[?LastModified>='2020-10-18T17:49:00.000Z'][]" \ | |
| --query 'Contents[?LastModified>2020-08-29][].{Key: Key,LastModified: LastModified}' | |
| --query 'Contents[?contains(LastModified, "2020-08-30")].Key' | 
  
    
      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
    
  
  
    
  | import { exec as defaultExec } from 'child_process' | |
| import fs from 'fs' | |
| import util from 'util' | |
| import safePromise from './safe-promise' | |
| const exec = util.promisify(defaultExec) | |
| const detectFile = async (filePath: string): Promise<string> => { | |
| // mmmagic avoided due to https://github.com/mscdex/mmmagic/issues/141#issuecomment-570085390 | |
| // file-typ avoided due to https://github.com/sindresorhus/file-type#supported-file-types | 
  
    
      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
    
  
  
    
  | image: node:10.13.0 | |
| stages: | |
| - setup | |
| - lint | |
| - coverage | |
| - deploy | |
| cache: | |
| untracked: true | 
  
    
      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
    
  
  
    
  | sudo gitlab-runner register \ | |
| --non-interactive \ | |
| --url "https://gitlab.com/your-user-name" \ | |
| --registration-token "PROJECT_REGISTRATION_TOKEN" \ | |
| --executor "ssh" \ | |
| --docker-image alpine:latest \ | |
| --description "ssh-runner-local-server" \ | |
| --tag-list "ci,cd,lint-check,test,coverage" \ | |
| --run-untagged="true" \ | |
| --locked="false" \ |