Skip to content

Instantly share code, notes, and snippets.

View kg's full-sized avatar

Katelyn Gadd kg

View GitHub Profile
@rygorous
rygorous / winrt_basic.cpp
Created April 7, 2014 18:11
WinRT basic D3D example, one file; all cube rendering/framework-y stuff removed, this just clears the screen every frame.
#include <wrl/client.h>
#include <d3d11_1.h>
#include <agile.h>
#include <ppl.h>
#include <ppltasks.h>
using namespace Microsoft::WRL;
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Core;
using namespace Windows::ApplicationModel::Activation;
@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:
+ {
anonymous
anonymous / product.c
Created August 24, 2013 21:00
/*
My results:
Given COUNT floats, each float ranging from [1/MAG, MAG]:
Naive product overflows easily (depends on MAG and COUNT)
Divide & conquer product can still overflow
@kg
kg / StructCopyElimination.cs
Created March 20, 2012 14:34
JSIL Code Sample: Struct Copy Elimination
using System;
public static class Program {
public static CustomType ReturnArgument (CustomType arg) {
return arg;
}
public static void Main (string[] args) {
var a = new CustomType(1);
var b = new CustomType(2);
@k0s
k0s / pbmoz.py
Created July 28, 2011 16:08 — forked from djmitche/pbmoz.py
stdin-to-pastebin script by @catlee
#!/usr/bin/env python
import urllib, sys
if len(sys.argv) == 2:
url = "http://%s.pastebin.mozilla.org" % sys.argv[1]
fmt = sys.argv[1]
else:
url = "http://pastebin.mozilla.org"
fmt = "None"
@kig
kig / gzip.js
Last active August 1, 2019 08:59
TarGZ = function(){};
// Load and parse archive, calls onload after loading all files.
TarGZ.load = function(url, onload, onstream, onerror) {
var o = new TarGZ();
o.onload = onload;
o.onerror = onerror;
o.onstream = onstream;
o.load(url);
return o;
/* MultiFile - A JavaScript library to load multiple files from
tar archives and json_packed files (see http://gist.github.com/407595)
Example: Loading multiple images from a tarball.
MultiFile.load('images.tar', function(xhr) {
this.files.forEach(function(f) {
var e = document.createElement('div');
document.body.appendChild(e);
var p = document.createElement('p');