Skip to content

Instantly share code, notes, and snippets.

M-Zuber / Withfunc.cs
Last active Dec 20, 2019
Use case for generic attributes in c#
View Withfunc.cs
using System;
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
sealed class LoggerAttribute<T> : Attribute
readonly Func<T, string> _template;
public LoggerAttribute(Func<T, string> positionalString)
_template = positionalString;
M-Zuber / cheer.snippet
Created Feb 17, 2019
VS Snippet to insert cheer messages during a live stream
View cheer.snippet
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="">
<CodeSnippet Format="1.0.0">
<Description>Code snippet for cheers during a live stream</Description>
<Author>Mordechai Zuber</Author>
View Program.cs
using System;
using System.Threading.Tasks;
namespace Example
internal class Program
private static void Main()
var t1 = (f: new Foo { A = 1 }, b: new Bar { B = 2 });
M-Zuber / generic.ts
Created Feb 21, 2018
Test case to understand how to use typescript generics properly. needs noImplicitAny set
View generic.ts
interface FilterOption {
key: string | number;
displayValue: string;
predicate: <TEntity>(e: TEntity) => boolean;
interface Registration {
id: number;
name: string;
date: string;
M-Zuber /
Created Apr 20, 2017
typescript config/concepts explanations
  • target tells TS what type of JS to generate, for es5 for conversion is required (for example let/const -> var, class -> function + prototype, etc.), whereas es6 can just leave the original code as is (after removing type information).
  • types tells TS about what types exists and what their API is. When using lib you are asking TS to add known core types that it already has definitions for, without having to add those yourself (for example, @types/core-js). When you import you adding more types that TS knows about. Additionally, you can use the types configuration property to add global types.
  • polyfills are required at runtime to ensure that older browsers can use the constructs (such as Promise) that exist natively in modern browsers. At this point, TS is not involved at all.
M-Zuber / foo.cs
Created Jan 30, 2017
Wierd IntelliSense thing
View foo.cs
public class Foo
public OtherClass GetThing(params object[] stuff) => new OtherClass(stuff);
public void DoThing()
var first = GetThing(..);
// This was reported as having type `dynamic`
var second = GetThing(..);
M-Zuber /
Created Aug 1, 2016 verification

Keybase proof

I hereby claim:

  • I am M-Zuber on github.
  • I am mordzuber ( on keybase.
  • I have a public key whose fingerprint is 6288 6DCE 6286 2CFC 772B 0B9E F0AA 364E A4D6 F64B

To claim this, I am signing this object:

M-Zuber /
Last active Feb 5, 2016
first-timer issue for