In order to run linter in a pre-commit hook you can check changed files only for performance reasons.
package.json:
{
"scripts": [
"fastlint": "git diff --cached --name-only | grep .ts$ | xargs -L1 \"./node_modules/.bin/tslint\" --fix"
],| function mySort(array $elements) { | |
| $sorted = true; | |
| for ($i = 0; $i < count($elements)-1; $i++) { | |
| if ($elements[$i] > $elements[$i+1]) { | |
| $tmp = $elements[$i+1]; | |
| $elements[$i+1] = $elements[$i]; | |
| $elements[$i] = $tmp; | |
| $sorted = false; | |
| } |
| function arabic2roman(num) { | |
| var romans = { | |
| 0: {"key": 1, "value": "I"}, | |
| 1: {"key": 4, "value": "IV" }, | |
| 2: {"key": 5, "value": "V"}, | |
| 3: {"key": 9, "value": "IX"}, | |
| 4: {"key": 10, "value": "X"}, | |
| 5: {"key": 40, "value": "XL"}, | |
| 6: {"key": 50, "value": "L"}, | |
| 7: {"key": 90, "value": "XC"}, |
| /** | |
| * Sum all odd Fibonacci Sequence elements less than given number | |
| * Return the sum of all odd Fibonacci numbers up to and including the passed number if it is a Fibonacci number. | |
| */ | |
| function sumOddFibs(num) { | |
| var sum = 0; | |
| var fibs = [1, 1]; | |
| while (Math.max.apply(Math, fibs) < num) { | |
| fibs.push(fibs[fibs.length-1]+fibs[fibs.length-2]); |
| var net = require("net"); | |
| var server = net.createServer(); | |
| var users = []; | |
| var tools = require("./tools")(users); | |
| server.on('connection', function (conn) { | |
| conn.setEncoding("utf8"); | |
| conn.write("Hello, what's your name?\r\n"); | |
| users.push(conn); |
| # Created by https://www.gitignore.io/api/macos,jetbrains+all | |
| ### JetBrains+all ### | |
| # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | |
| # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | |
| # User-specific stuff: | |
| .idea/**/workspace.xml | |
| .idea/**/tasks.xml |
| export class Challenge { | |
| public static sortCsvColumns (csv_data: string): string { | |
| const rows = csv_data.split('\n').map(row => row.split(',')); | |
| const data: CsvData = {}; | |
| for (const row of rows) { | |
| for (let i = 0; i < row.length; i++) { | |
| const header = rows[0][i].toLowerCase(); | |
| if (!data[header]) { | |
| data[header] = []; | |
| } else { |
| import { CommonModule } from '@angular/common'; | |
| import { Injectable, NgModule, Pipe, PipeTransform } from '@angular/core'; | |
| import { | |
| DomSanitizer, | |
| SafeHtml, | |
| SafeResourceUrl, | |
| SafeScript, | |
| SafeStyle, | |
| SafeUrl, | |
| } from '@angular/platform-browser'; |
sam build && concurrently "nodemon --on-change-only --ext ts --exec sam build" "sam local start-api"
Requires npm i -g nodemon concurrently
It runs nodemon and sam local start-api in the background simultaneously. The trick is to have the build available before creating docker image, so it's done beforehand and nodemon does it only after changes (using --on-change-only flag).