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
param( | |
[Parameter(Mandatory = $true)] | |
[string]$rootPath = "", | |
[Parameter(Mandatory = $true)] | |
[string]$outputFile = "", | |
[Parameter(Mandatory = $false)] | |
[string]$filter = "*" | |
) |
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
using System.Text.RegularExpressions; | |
namespace ImageHelper.Shared; | |
public class ImageGrouper | |
{ | |
private string _parentFolder; | |
private SearchOption _option; | |
private readonly List<string> _imageExtensions = new List<string> { ".jpg", ".jpeg", ".png", ".gif" }; |
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
docker volume create pgdata | |
docker run -d ` | |
--name my_postgres ` | |
-e POSTGRES_USER=postgres ` | |
-e POSTGRES_PASSWORD=myPassword ` | |
-e POSTGRES_DB=postgres ` | |
-e PGDATA=/var/lib/postgresql/data/pgdata ` | |
-v pgdata:/var/lib/postgresql/data/pgdata ` | |
-p 5432:5432 ` | |
postgres:latest |
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
xmlns:rxuno="using:ReactiveUI.Uno" | |
xmlns:android="http://uno.ui/android" | |
xmlns:ios="http://uno.ui/ios" | |
xmlns:macos="http://uno.ui/macos" | |
xmlns:wasm="http://uno.ui/wasm" | |
xmlns:not_win="http://uno.ui/not_win" | |
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:not_android="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
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 fs = require("fs"); | |
const path = require("path"); | |
const cp = require("child_process"); | |
const clone = (package) => { | |
if (!fs.existsSync(package)) { | |
console.log(`Start to clone ${package}`); | |
cp.execSync(`git clone https://github.com/d3/${package}.git --depth=1`); | |
} | |
} |
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
/** | |
* | |
* @param {ArrayLike} sa - series a | |
* @param {ArrayLike} sb - series b | |
* @param {boolean} [isContinuous=false] - is sub series continuous | |
* @returns {Array<Array<any>>} - all longest common series | |
*/ | |
function longestCommonSeries(sa, sb, isContinuous = false) { | |
if (sa.length === 0 || sb.length === 0) { |
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
function heapify(array, index, heapSize, cmp) { | |
let left = 2 * index + 1; | |
let right = 2 * index + 2; | |
let largest = index; | |
if (left < heapSize && cmp(array[left], array[index]) > 0) { | |
largest = left; | |
} | |
if (right < heapSize && cmp(array[right], array[largest]) > 0) { | |
largest = right; | |
} |
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 defaultCompare = (a, b) => a < b; | |
const swapArrayItem = (arr, i, j) => { | |
let tmp = arr[i]; | |
arr[i] = arr[j]; | |
arr[j] = tmp; | |
}; | |
const bubbleSort = (arr, compare = defaultCompare) => { | |
let len = arr.length; |
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
function KMPSearch(pattern: string, text: string): number { | |
if (pattern.length === 0) return 0; | |
const lsp = generateLSP(pattern); | |
let j = 0; | |
for (let i = 0; i < text.length; i++) { | |
while (j > 0 && text.charAt(i) !== pattern.charAt(j)) { | |
j = lsp[j - 1]; | |
} |
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 baseTypes = [ | |
"[object Number]", | |
"[object String]", | |
"[object Undefined]", | |
"[object Boolean]", | |
"[object Symbol]", | |
"[object Function]" | |
] | |
function deepEqual(a, b) { | |
const typeOfA = Object.prototype.toString.call(a); |
NewerOlder