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
| FROM_TEXT=CX-133209 | |
| TO_TEXT=CX-136414 | |
| FEAT_BRANCH_NAME=cx-136414 | |
| BASE_BRANCH_NAME=master | |
| "C:/Program Files/Python312/python.exe" git-filter-repo.py --commit-callback ' | |
| msg = commit.message.decode("utf-8") | |
| newmsg = msg.replace("${FROM_TEXT}", "${TO_TEXT}") | |
| commit.message = newmsg.encode("utf-8") |
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 { Directive, HostListener } from '@angular/core'; | |
| import { NgControl } from '@angular/forms'; | |
| // Trims text for an Angular form control as the text is input, e.g. " foobar " -> "foobar" | |
| @Directive({ | |
| selector: '[trimOnInput]', | |
| standalone: true, | |
| }) | |
| export class TrimOnInputDirective { |
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
| // Playground here: https://codepen.io/tw3/pen/eYaMPOZ | |
| function parseCsp(csp) { | |
| const result = []; | |
| const cspArr = csp.split(';'); | |
| cspArr.forEach((x) => { | |
| const vals = x.trim().split(' ').filter(Boolean); | |
| let idx = 0; | |
| const entryArr = []; | |
| entryArr.push(vals[idx++]); // resource, e.g. default-src |
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
| export class RotatingIterator<T> implements Iterable<T> { | |
| private readonly origStart: number; | |
| private nextIndex: number; | |
| private isDone: boolean; | |
| private hasLooped: boolean; | |
| constructor(private readonly arr: T[], private startIndex = 0) { | |
| this.origStart = startIndex; | |
| this.nextIndex = startIndex; |
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
| alias gdbak='GDBAK_FILENAME="../../temp/diff-bak-$(date +%s%3N)_$(git branch --show-current).tar"; tar cvf "${GDBAK_FILENAME}" `git diff --name-only`; echo "${GDBAK_FILENAME}"' |
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
| #!/usr/bin/env bash | |
| TARGET_BRANCH=$(git branch --show-current) | |
| if [ -z "${TARGET_BRANCH}" ]; then | |
| echo "Please cd into to the target branch" | |
| exit; | |
| fi | |
| echo "Cherry-picking to branch: ${TARGET_BRANCH}" | |
| read -p "Cherry-picking from branch: " SOURCE_BRANCH |
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
| #!/usr/bin/env bash | |
| main() { | |
| echo "Here's an example:" | |
| echo "" | |
| echo "\"C:/Program Files/Python39/python.exe\" c:/bin/git-filter-repo.py --commit-callback '" | |
| echo "msg = commit.message.decode(\"utf-8\")" | |
| echo "newmsg = msg.replace(\"TEXT_FROM\", \"TEXT_TO\")" | |
| echo "commit.message = newmsg.encode(\"utf-8\")" |
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
| /** | |
| * Example: | |
| * | |
| * const builder = new XPathBuilder(); | |
| * const xpathStr = builder | |
| * .addDescendant({ nodeName: 'carbon-dropdown' }) | |
| * .addDescendant({ className: 'bx--label', innerText: 'AWS Region' }) | |
| * .addAncestor({ nodeName: 'carbon-dropdown' }) | |
| * .build(); | |
| * |
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 { defer, Observable, ObservableInput } from 'rxjs'; | |
| import { finalize } from 'rxjs/operators'; | |
| /** | |
| * This is an RxJS operator that keeps a running counter of the number of active requests. | |
| * This can be used to show a spinner for the first of a series of requests, and hide the spinner | |
| * once all requests in the series are complete. | |
| * | |
| * For example: | |
| * const activeRequestMonitor: ActiveRequestMonitor = monitorActiveRequests({ |
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 { Injectable } from '@angular/core'; | |
| import { | |
| EMPTY, | |
| merge as observableMerge, | |
| Observable, | |
| of as observableOf, | |
| Subject, | |
| timer as observableTimer | |
| } from 'rxjs'; | |
| import { delay, expand, map, takeUntil, takeWhile } from 'rxjs/operators'; |
NewerOlder