Skip to content

Instantly share code, notes, and snippets.

View monoman's full-sized avatar
🔗
Interlocking...

Rafael Teixeira monoman

🔗
Interlocking...
View GitHub Profile
@madskristensen
madskristensen / VSIX-Checklist.md
Last active August 6, 2023 13:07
VS extension checklist

Visual Studio Extensibility Checklist

Here is a list of things to make sure to remember before publishing your Visual Studio extension.

Adhere to threading rules

Add the Microsoft.VisualStudio.SDK.Analyzers NuGet package to your VSIX project, which will help you discover and fix common violations of best practices regarding threading.

Add high-quality icon

All extensions should have an icon associated with it. Make sure the icon is a high-quality .png file with the size 90x90 pixels in 96 DPI or more. After adding the icon to your VSIX project, register it in the .vsixmanifest file as both the Icon and Preview image.

Name and description

@hammett
hammett / ringbuffer.cs
Created December 31, 2015 06:49
stream ring buffer
internal class RingBufferStream : Stream
{
private const int BufferSize = 1024;
private volatile int _totalLen = 0;
private volatile int _readPosition = -1;
private volatile int _writePosition = -1;
private readonly ManualResetEventSlim _locker = new ManualResetEventSlim(false);
private readonly byte[] _buffer;
@monoman
monoman / TranslatableStrings_Example.cs
Last active August 29, 2015 14:23
TranslatableStrings aims to enable Roslyn to again be at peace with resources or any other translation mechanism when using string interpolation
var person="David";
Console.WriteLine($_"Hello {person}");
// Prints "Alô David" in pt-BR
Console.WriteLine($"Hello {person}");
// Prints "Hello David" in pt-BR
@jbevain
jbevain / roslyn-enumerable-of-t.diff
Last active August 29, 2015 13:58
Roslyn patch to add syntactic sugar to C# replacing IEnumerable<T> with T~
diff --git a/Src/Compilers/CSharp/Source/Binder/Binder_Symbols.cs b/Src/Compilers/CSharp/Source/Binder/Binder_Symbols.cs
index ce0a903..b34b498 100644
--- a/Src/Compilers/CSharp/Source/Binder/Binder_Symbols.cs
+++ b/Src/Compilers/CSharp/Source/Binder/Binder_Symbols.cs
@@ -379,6 +379,20 @@ namespace Microsoft.CodeAnalysis.CSharp
return new PointerTypeSymbol(elementType);
}
+ case SyntaxKind.EnumerableType:
+ {
@haacked
haacked / code-review-checklist.md
Last active March 9, 2020 19:28
Code Review Checklist

General

  1. Unit tests: Review unit tests first. Unit tests are a fantastic way to grasp how code is meant to be used by others and to learn what the expected behavior is. Are there any test gaps that should be there?
  2. Method arguments" Make sure arguments to methods make sense and are validated. Mentally test boundary conditions and edge cases.
  3. Null References" (Yah yah, we know. Use F# and this goes away. We get it already.) Null references are a bitch and it’s worth looking out for them specifically.
  4. Conventions Consistency" Make sure naming, formatting, etc. follow our conventions and are consistent. I like a codebase that’s fairly consistent so you know what to expect.
  5. Disposables: Make sure disposable things are disposed. Look for usages of resources that should be disposed but are not.
  6. Security: There is a whole threat and mitigation review process that falls under this bucket. In simple terms, ask yourself how this code could be exploited. The [STRIDE Threat Mo
anonymous
anonymous / gist:1406238
Created November 29, 2011 20:09
Originally:
https://gist.github.com/7565976a89d5da1511ce
Hi Donald (and Martin),
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I
appreciate the tone. This is a Yegge-long response, but given that you and
Martin are the two people best-situated to do anything about this, I'd rather
err on the side of giving you too much to think about. I realize I'm being very
critical of something in which you've invested a great deal (both financially
@monoman
monoman / ReadonlyProperties.cs
Last active September 26, 2015 05:48
I would do differently on a light C# example from http://www.trelford.com/blog/post/LighterCSharp.aspx
public class Person {
public Person(string name, int age) {
_name = name;
_age = age;
}
private readonly string _name;
private readonly int _age;
/// Full name
public string Name { get _name; }
/// Age in years
@otac0n
otac0n / SplayTree`2.cs
Last active December 5, 2019 09:55
A splay tree in C# for .NET, fully implementing IDictionary<TKey, TValue>.
/* ---- MIT LICENSE ----
Copyright (c) 2011 John Gietzen
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:
@monoman
monoman / jarcheck.bat
Created February 18, 2011 17:47
A replacement .bat that works on windows (NT 4 and up) for JarCheck http://www.softpedia.com/get/Programming/Other-Programming-Files/JarCheck.shtml
@echo off
echo ===============================================================================================================
set TOP=%1
if not "%TOP%"=="" goto scanning
set TOP=1.5
:scanning
echo Checking for java classes with versions higher than %TOP% in all .jar files in the current directory
del jarcheck.log
FOR %%j IN (*.jar) DO java.exe -ea -jar %~d0%~p0\jarcheck.jar %%~fj 1.1 %TOP% 2>> jarcheck.log > null
echo ===============================================================================================================
@viniciusteles
viniciusteles / gist:556029
Created August 29, 2010 06:20
Sete Atitudes para Hackear a Indústria de Software
Sete Atitudes para Hackear a Indústria de Software
By Klaus Wuestefeld
1) Torne-se excelente.
Seja realmente bom em alguma coisa. Não fique só choramingando ou
querendo progredir às custas dos outros. Não pense q pq vc sentou 4
anos numa faculdade ouvindo um professor falar sobre software q vc
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo