Skip to content

Instantly share code, notes, and snippets.

View pielegacy's full-sized avatar

Alex Billson pielegacy

  • Mecca Brands
  • Melbourne, Australia
  • 16:18 (UTC -12:00)
View GitHub Profile
@pielegacy
pielegacy / VariousOpinionsOnProgramming.md
Last active January 7, 2024 06:59
Various opinions on programming

My Various Programming Opinions

These aren't supposed to be hot takes as most of these are pretty lukewarm and things that for the majority people follow anyway, thought it would be nice to have them all in one place.

Loops vs Functional Array Methods

I like to use loops where possible with functional array methods (not sure what the best terminology for it is but in JS it's stuff like map, reduce, filter and in C# it's Where, Select etc...).

The design of these array methods is to follow very standard functional programming concepts so methods such as a .ForEach where nothing is returned from these iterations always bug me.

@hyrmn
hyrmn / DapperExtensions.cs
Last active December 18, 2023 09:16
Extension methods for calling Dapper asynchronously with a Polly retry
public static class DapperExtensions
{
private static readonly IEnumerable<TimeSpan> RetryTimes = new[]
{
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(3)
};
private static readonly AsyncRetryPolicy RetryPolicy = Policy
@DanDiplo
DanDiplo / JS-LINQ.js
Last active April 29, 2024 10:30
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version):
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },