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
-- Generates a script to rename all objects to upper case in snowflake | |
EXECUTE IMMEDIATE $$ | |
DECLARE | |
object_types ARRAY; | |
object_type STRING; | |
alter_type STRING; | |
singular_map OBJECT; | |
max_count INTEGER; | |
alter_statements ARRAY := ['ALTER SESSION SET QUOTED_IDENTIFIERS_IGNORE_CASE = FALSE;']; |
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
// Quick sketch of how the zustand api could be used with the full power of redux behind for when things get more complex | |
import { createSlice } from '@reduxjs/toolkit'; | |
export function createZustandishSlice(name, creator) { | |
const initialState = {}; | |
const creatorActions = {}; | |
// Discover the store's shape by separating initial state from action functions. | |
const storeShape = creator(() => { }, () => { }); |
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 System; | |
using System.Reflection; | |
using Microsoft.EntityFrameworkCore; | |
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] | |
public sealed record TemporalTableAttribute(string HistoryTableName, string PeriodStartColumnName, string PeriodEndColumnName) : Attribute; | |
public class YourDbContext : DbContext | |
{ | |
protected override void OnModelCreating(ModelBuilder modelBuilder) |
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 class DictionaryExtensions | |
{ | |
public static TValue Get<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dict, TKey key, TValue defaultValue = default(TValue)) | |
=> dict.TryGetValue(key, out var actualValue) ? actualValue : defaultValue; | |
public static TValue Get<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key, TValue defaultValue = default(TValue)) | |
=> dict.TryGetValue(key, out var actualValue) ? actualValue : defaultValue; | |
public static TValue Get<TKey, TValue>(this Dictionary<TKey, TValue> dict, TKey key, TValue defaultValue = default(TValue)) |
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 Get-LinesChanged() { | |
$diffFromCommonBase = git diff origin/master...HEAD --unified=0 --dst-prefix="" | |
$linesByFile = @{} | |
$currentLines = New-Object System.Collections.ArrayList | |
foreach ($diffLine in $diffFromCommonBase ) { | |
if ($diffLine.StartsWith("+++")) { | |
#e.g. "+++ Path/to/file.cs" -> "Path/to/file.cs" | |
$currentFile = $diffLine.Substring(4) | |
$currentLines = $linesByFile[$currentFile] = New-Object System.Collections.ArrayList |