Skip to content

Instantly share code, notes, and snippets.

View bforrest's full-sized avatar
💭
Red, red, red, GREEN, refactor

Barry Forrest bforrest

💭
Red, red, red, GREEN, refactor
View GitHub Profile
@kamilogorek
kamilogorek / _screenshot.md
Last active April 26, 2025 16:35
Clutter-free VS Code Setup
image
@clemensv
clemensv / messaging-and-eventing-platforms.md
Created January 5, 2022 14:43
Elements of Messaging and Eventing Platforms
title
Elements of Messaging and Eventing Platforms

This document provides a brief overview of the essential elements of a messaging and eventing platform and how they relate to each other.

Message and Event Broker Categories

@kyleshevlin
kyleshevlin / index.js
Last active September 22, 2020 12:39
Recolor your GH contribution graph
// Run this in your console with whatever `newColors` you choose.
function recolorContributionGraph(newColors) {
const days = [...document.querySelectorAll('.day')]
const legendItems = [...document.querySelectorAll('.legend > li')]
const colors = [
...days.reduce((acc, day) => {
acc.add(day.getAttribute('fill'))
return acc
}, new Set()),
]
@paulczy
paulczy / ETagAttribute.cs
Last active April 26, 2018 15:32
Add ETags to your ASP.NET Core responses.
using System;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Newtonsoft.Json;
using Newtonsoft.Json.Bson;
// ReSharper disable once CheckNamespace
@vkhorikov
vkhorikov / CustomerController.cs
Last active April 20, 2025 09:15
Handling failures and input errors in a functional way
[HttpPost]
public HttpResponseMessage CreateCustomer(string name, string billingInfo)
{
Result<BillingInfo> billingInfoResult = BillingInfo.Create(billingInfo);
Result<CustomerName> customerNameResult = CustomerName.Create(name);
return Result.Combine(billingInfoResult, customerNameResult)
.OnSuccess(() => _paymentGateway.ChargeCommission(billingInfoResult.Value))
.OnSuccess(() => new Customer(customerNameResult.Value))
.OnSuccess(
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@bforrest
bforrest / window.console.js
Created July 27, 2012 15:24
console log javascript snippet
if (!window.console) {
(function() {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i) {
window.console[names[i]] = function() {};
}
}());
}