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
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Server.Kestrel.Core; | |
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Security.Cryptography.X509Certificates; | |
namespace Microsoft.Extensions.Hosting | |
{ |
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
{ | |
"workbench.colorTheme": "Default Light+", | |
"workbench.colorCustomizations": { | |
"debugConsole.infoForeground": "#222222", | |
"debugConsole.errorForeground": "#cc0000", | |
"debugConsole.warningForeground": "#777700", | |
"debugConsole.sourceForeground": "#0088cc" | |
} | |
} |
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
function $localize(s: TemplateStringsArray) { | |
if (s.raw[0][0] === ':') { | |
const i = s[0].indexOf(':', 1) | |
if (i > 0) { | |
return s[0].substring(i + 1); | |
} | |
} | |
return s[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
components: | |
schemas: | |
User: | |
title: User | |
description: User Model | |
type: object | |
properties: | |
id: | |
type: integer | |
firstName: |
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
// Fastest install script for npm 7.0+ | |
// usage: node install | |
const fs = require('fs'); | |
const readLockFile = path => { | |
if (fs.existsSync(path)) { | |
const text = fs.readFileSync(path, { encoding:'utf8', flag:'r' }); | |
const lockFile = JSON.parse(text); | |
delete lockFile.dependencies; |
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
public static string GetUniqueStringValue(int size) | |
{ | |
var data = new byte[size]; | |
using var crypto = RandomNumberGenerator.Create(); | |
crypto.GetBytes(data); | |
for (var i = 0; i < size; i++) | |
{ | |
data[i] = (byte)('a' + data[i] % 26); | |
} | |
return Encoding.ASCII.GetString(data); |
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
SELECT GravatarUrl = | |
'https://www.gravatar.com/avatar/' + | |
LOWER(CONVERT(VARCHAR(32), HashBytes('MD5', '[email protected]'), 2)) + | |
'?s=48&d=https%3A%2F%2Fmyserver.test%2Fdefault.png' |
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 truncateObject = o => { | |
if (!o) { | |
return o; | |
} | |
if (typeof o === 'string') { | |
return o.substring(0, 64); | |
} | |
if (Array.isArray(o)) { | |
return o.slice(0, 5).map(x => truncateObject(x)); | |
} |
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
/** | |
* ignores comments and whitespaces in regexp patterns, | |
* similar to RegexOptions.IgnorePatternWhitespace in C# | |
* or Pattern.COMMENTS in Java. | |
* @example | |
* // returns /[a-z][0-9]+/i | |
* new RegExp(ignoreWhitespaces` | |
* [a-z] # any latin letter | |
* [0-9]+ # any number | |
* `, 'i'); |
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
private const string BaseDir = @"C:\Users\username\Desktop\dir"; | |
private static readonly Regex _files = new( | |
@".*\.(xml)$", | |
RegexOptions.IgnoreCase | RegexOptions.Compiled); | |
private static readonly Regex _ignoredDir = new( | |
"^(node_modules|bin|obj)$", | |
RegexOptions.IgnoreCase | RegexOptions.Compiled); |