Skip to content

Instantly share code, notes, and snippets.

public abstract class ConfigurationElementCollection<TKey, TElement>
: ConfigurationElementCollection,
IList<TElement>, IDictionary<TKey, TElement>
where TElement : ConfigurationElement, new()
{
protected override ConfigurationElement CreateNewElement()
{
return new TElement();
}
using System;
using System.Collections.Generic;
using System.Linq;
namespace Voron.Util
{
/// <summary>
/// A list that can be used by readers as a true immutable read-only list
/// and that supports relatively efficient "append to the end" and "remove
/// from the front" operations, by sharing the underlying array whenever
@XVilka
XVilka / TrueColour.md
Last active April 27, 2025 10:17
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@t-mat
t-mat / win32-range-based-find-first-file.cpp
Last active January 2, 2016 23:29
Win32, C++11: FindFirstFile() iterator for range-based for
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <locale.h>
template<class> struct FindFilesData {};
template<> struct FindFilesData<char> { using Type = WIN32_FIND_DATAA; };
template<> struct FindFilesData<wchar_t> { using Type = WIN32_FIND_DATAW; };

Effective ML (and F#)

24 Jun 2012

This is a summary of Yaron Minsky’s nine pieces of advice from the Effective ML video. Since ML is a predecessor of F#, most of the advice applies to F# as well.


Favor readers over writers (10:20). There’re systematic differences in opinion between those who spent their time reading code and those who spent it writing code. Whenever there’s a difference in opinion between these two groups, the readers are always right and the writers are always wrong. The readers will always push in the direction of clarity and simplicity and the ability to change behavior easily. At least if you’re building software that’s going to last.

diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index b78e9f5..f6aa264 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -1200,8 +1200,11 @@ unsigned SourceManager::getPresumedColumnNumber(SourceLocation Loc,
if (isInvalid(Loc, Invalid)) return 0;
return getPresumedLoc(Loc).getColumn();
}
-
-#ifdef __SSE2__
@berkus
berkus / CMakeLists.txt
Created April 3, 2014 13:52
Competition winner from Twitter image encoding challenge - http://stackoverflow.com/questions/891643/twitter-image-encoding-challenge
CMAKE_MINIMUM_REQUIRED( VERSION 2.4 )
PROJECT( nanocrunch )
ADD_EXECUTABLE( nanocrunch nanocrunch.cpp )
INCLUDE( FindImageMagick )
FIND_PACKAGE( ImageMagick COMPONENTS Magick++ )
IF( ImageMagick_FOUND )
INCLUDE_DIRECTORIES( ${ImageMagick_INCLUDE_DIRS} )
TARGET_LINK_LIBRARIES( nanocrunch ${ImageMagick_LIBRARIES} )
@CrabDude
CrabDude / callback_contract.md
Last active December 20, 2019 18:50
Node.js Callback Contract

Node.js Callback* Contract

(aka "errback" or "error first callback")

  1. Function that takes 2 arguments
    • first argument is an error
    • second argument is the result
    • Never pass both
    • error should be instanceof Error
  2. Must never excecute on the same tick of the event loop
  3. Must be passed as last argument to function
@Daniel15
Daniel15 / gist:11127778
Created April 20, 2014 23:18
ILMerge from MSBuild

Install ILMerge from NuGet Set assembly name to "Blah.original.dll"

Set Post-build event command line to:

"$(SolutionDir)packages\ilmerge.2.13.0307\ilmerge.exe" /keyfile:"$(SolutionDir)Key.snk" /out:"$(TargetDir)$(ProjectName).dll" "$(TargetPath)" "$(SolutionDir)lib\foo.dll" "$(SolutionDir)lib\bar.dll"

This will generate a "Blah.dll" with foo.dll and bar.dll merged into it.