Skip to content

Instantly share code, notes, and snippets.

View oising's full-sized avatar
🐢
Taking it easy

Oisin Grehan oising

🐢
Taking it easy
View GitHub Profile
@wekempf
wekempf / LoggingExtra.cs
Created June 9, 2021 00:11
Microsoft.Extensions.Logging with extra data
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
@creyke
creyke / OrleansEventHubCustomData.cs
Created September 21, 2020 14:19
Orleans Event Hub Custom Data
public class CustomEventHubDataAdapter : EventHubDataAdapter
{
private readonly SerializationManager serializationManager;
public CustomEventHubDataAdapter(SerializationManager serializationManager)
: base(serializationManager)
{
this.serializationManager = serializationManager;
}
@thomastay
thomastay / prompt.ps1
Last active April 3, 2023 15:00
Powershell fish prompt
function replaceHome($pathArray) {
# Check whether the first three paths are equal to HOME
# If it is, it substitutes it for ~
# Change this accordingly, if your home path is more than three
# paths long.
$splitChar = [System.IO.Path]::DirectorySeparatorChar
if ( ($pathArray.Length -gt 2) -and
(($pathArray[0..2] -join $splitChar) -eq $HOME)) {
@("~") + $pathArray[3..$pathArray.Length]
}
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active July 20, 2024 05:29
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@krist00fer
krist00fer / Get-AzureUsageCost.ps1
Last active May 8, 2024 16:39
PowerShell Script to retrieve Azure Usage and Cost/Pricing
# Licensed under the MIT license.
# Copyright (C) 2017 Kristofer Liljeblad
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@Rich-Harris
Rich-Harris / footgun.md
Last active July 8, 2024 03:54
Top-level `await` is a footgun

Edit — February 2019

This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:

  • TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
  • In the wild, we're seeing (async main(){...}()) as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems
  • Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.

I'll leave the rest of this document unedited, for archaeological

@mbroadst
mbroadst / ajv-validator.js
Last active August 15, 2020 15:04 — forked from jdanyow/app.html
Aurelia Validation using AJV
import {ValidationError} from 'aurelia-validation';
export class AjvValidator {
cache = new Map;
ajv = new Ajv({ v5: true, allErrors: true, format: 'full' });
validateObject(object) {
this.parseSchema(object);
let schemaId = this._schemaId(object);
if (!this.cache.has(schemaId)) {
@Jaykul
Jaykul / FileTypes.ANSI.Format.ps1xml
Last active March 13, 2018 00:10
ANSI Escape Sequences
<?xml version="1.0" encoding="utf-8" ?>
<!-- *******************************************************************
This is Joel "Jaykul" Bennett's coloring format file for PowerShell 5.1
******************************************************************** -->
<Configuration>
<SelectionSets>
<SelectionSet>
<Name>FileSystemTypes</Name>
<Types>
<TypeName>System.IO.DirectoryInfo</TypeName>
@altrive
altrive / PSv5_Preview_Features.md
Last active April 24, 2016 16:45
PowerShell v5 Undocumented Features List
Note: Following features are tested on Windows 10 Preview Build 10074 environment

PSReadLine

Windows 10 Preview contains PSReadLine module at "%ProgramFiles%\WindowsPowerShell\Modules" (WMF 5.0 Preview don't contain this modules)

PSReadLine is automatically loaded when PSConsoleHost launched(if available). This feature can be controlled by following command.