Skip to content

Instantly share code, notes, and snippets.

View martea's full-sized avatar
🏠
Working from home

Mårten Andersson martea

🏠
Working from home
View GitHub Profile
@martea
martea / scroll.css
Created April 22, 2021 06:46
scroll
::-webkit-scrollbar {
-webkit-appearance: none;
background-color: rgba(0, 0, 0, 0.1);
width: 7px;
height: 7px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0, 0, 0, 0.5);
@martea
martea / docker-compose.yml
Last active April 8, 2021 07:29
docker compose redis & commander
version: '3'
services:
redis:
container_name: redis
hostname: redis
image: redis
ports:
- "6379:6379"
redis-commander:
@martea
martea / JsonElementConverter.cs
Created February 4, 2021 07:47
JsonElementConverter for newtonsoft
public class JsonElementConverter : Newtonsoft.Json.JsonConverter<System.Text.Json.JsonElement>
{
public JsonElementConverter()
{
}
public override System.Text.Json.JsonElement ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, [System.Diagnostics.CodeAnalysis.AllowNull] System.Text.Json.JsonElement existingValue, bool hasExistingValue, Newtonsoft.Json.JsonSerializer serializer)
{
throw new NotImplementedException();
}
@martea
martea / startup.cs
Created August 11, 2020 08:49
Debug assembly location
private void DebugAssmeblies(Assembly[] assemblies)
{
foreach (var item in assemblies)
{
logger.Log(LogLevel.Debug, item.FullName);
logger.Log(LogLevel.Debug, item.CodeBase);
}
}
@martea
martea / resources.json
Last active April 14, 2020 13:10
resx import contract, complex type or singlefile type
[ {
"Key": "InvalidDate",
"Text": "Invalid date",
"DefaultText": "Invalid date"
}]
@martea
martea / remove-older-than-30-days.ps1
Created November 27, 2019 14:55
Remove files older than 30 days
Get-ChildItem -r | ?{ !$_.PSIsContainer } | ?{ $_.LastWriteTime -LT (Get-Date).AddDays(-30)} | Remove-Item -Verbose
@martea
martea / Swashbuckle.DepricatedFilters.ex.cs
Last active November 22, 2019 13:28
Swashbuckle depricated / Obsolete OAS3
using System.Linq;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
public class DepricatedOperationFilter : IOperationFilter
{
public void Apply(OpenApiOperation operation, OperationFilterContext context)
{
operation.Deprecated = context.MethodInfo.GetCustomAttributes(false).OfType<System.ObsoleteAttribute>().Any();
}
@martea
martea / assert.js
Created November 18, 2019 22:36
assert js
function Assert() {
}
Assert.prototype.equal = function (cb, result, title) {
var correct = cb == result;
console.log(title + ", ", correct, !correct ? `, expected ${result} but was ${cb}` : "");
}