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
#nullable enable | |
ObservableCollection<KeyValuePair<string, string?>> inMemoryOptions = new() | |
{ | |
new("MyOptions:MyProperty", "Foo"), | |
}; | |
var builder = Host.CreateDefaultBuilder(); | |
builder |
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
var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json)); | |
using var stream = new MemoryStream(); | |
using (var writer = new Utf8JsonWriter(stream)) | |
{ | |
while (reader.Read()) | |
{ | |
switch (reader.TokenType) | |
{ | |
case JsonTokenType.None: |
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.Diagnostics; | |
namespace PRunner; | |
public interface IProcessRunner | |
{ | |
Task<ProcessResult> ExecuteProcess( | |
string executable, | |
string arguments, | |
CancellationToken cancellationToken, |
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
# Might need this later on: https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-core-60?view=powershell-6#backwards-compatibility-with-windows-powershell | |
# Install posh-git first with | |
# > PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force | |
Import-Module posh-git # Might want to add it to $profile.CurrentUserAllHosts instead: https://github.com/dahlbyk/posh-git#step-2-import-posh-git-from-your-powershell-profile | |
Set-PSReadLineOption -Colors @{ "Command"=[ConsoleColor]::DarkYellow } | |
Import-Module C:\_repos\tools\scripts\Eparkering-Module\EparkeringModule\EparkeringModule.psd1 |
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
<span> | |
<button type="button" class=" | |
EdgeButton | |
EdgeButton--danger | |
EdgeButton--small | |
button-text | |
follow-text" onclick="jQuery.post('https://api.twitter.com/1.1/users/report_spam.json?screen_name=rabish2&perform_block=true')"> | |
<span aria-hidden="true">Spam</span> | |
<span class="u-hiddenVisually">Report <span class="username u-dir u-textTruncate" dir="ltr">@<b>rabish2</b></span></span> |
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
USE DATABASENAME | |
DECLARE @table varchar(250) = 'TABLENAME' | |
SELECT name, is_nullable | |
FROM sys.columns | |
WHERE object_id = object_id(@table) | |
AND is_nullable = 0 | |
ORDER BY name |
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
; Create Task | |
;RunWait, %A_WinDir%\System32\schtasks.exe /create /TN AHK /TR C:\Users\oskkli\Documents\AutoHotkey\AutoHotkeyScript.ahk /RL HIGHEST /SC ONLOGON | |
#SingleInstance, force ; Always replaces the old instance automatically | |
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
SetCapsLockState, AlwaysOff ; Turn off Caps Lock | |
SetNumLockState, AlwaysOn ; Set state to On and then disable NumLock |
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
--from SO and changed according to the comments: http://stackoverflow.com/questions/5873170/generate-class-from-database-table | |
declare @TableName sysname = 'Bilplats' | |
declare @Result varchar(max) = 'public class ' + @TableName + ' | |
{' | |
select @Result = @Result + ' | |
public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; } | |
' | |
from |
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
interface NodeRequire { | |
ensure: (paths: string[], callback: (require: NodeRequireFunction) => void) => void | |
} |
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
private static void SaveChanges(DbContext context) | |
{ | |
try | |
{ | |
context.SaveChanges(); | |
} | |
catch (DbEntityValidationException exception) | |
{ | |
var sb = new StringBuilder(); | |
foreach (var failure in exception.EntityValidationErrors) |