Skip to content

Instantly share code, notes, and snippets.

View jbevain's full-sized avatar

Jb Evain jbevain

View GitHub Profile
@jbevain
jbevain / gist:647076
Created October 26, 2010 15:14
Node dumper using y combinator
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Node {
public string Text { get; private set; }
public IList<Node> Children { get; private set; }
@jbevain
jbevain / il.boo
Created March 23, 2011 09:18
boo il macro
import Boo.Lang.Compiler
import Boo.Lang.Compiler.Ast
import Boo.Lang.PatternMatching
import System
import System.Collections.Generic
import System.Reflection
import System.Reflection.Emit
macro il(obj as ReferenceExpression):
If there’s one thing I’ve come to learn about life, it’s that most things are neither completely black nor completely white. There’s an infinity of shade of grays in between.
And if the announce of the Visual Studio (VS from now on) 11 beta taught me something, it is that VS 11 is exactly that. Neither completely black, nor completely white. But very gray. Oh so gray.
I won’t comment about the new look here, as the object of my ire with VS and its apparent roadmap lies at a completely different level. And boy am I annoyed to see where the VS team puts its focus.
Visual Studio 11 will be the sixth iteration of Visual Studio with .net support. And it’s still a terrible platform for the .net programmer.
Do you remember Steve Yegge’s rant about the need of a programmable platform at Google? It’s a tad long (euphemism of the day), but it’s well worth the read. And with Visual Studio, Microsoft is exactly failing at that.
@jbevain
jbevain / codeof.fs
Last active December 18, 2015 20:38
open System
open System.Reflection
open Microsoft.FSharp.Quotations
open Microsoft.FSharp.Quotations.Patterns
[<ReflectedDefinition>]
let id x = x
[<ReflectedDefinition>]
using System.Diagnostics;
using System.Globalization;
using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
public static class VisualStudioFileOpening
{
open System
open System.Text
type StringIndex =
struct
val String: string
val Index: int
end
new(s: string) = { String = s; Index = 0 }
@jbevain
jbevain / reflection.fs
Created December 20, 2013 16:00
Consuming a reflection type provider.
open System
open System.Reflection
open System.Reflection.Emit
open SyntaxTree.Reflection
let corlib = Assemblies.mscorlib
let console = corlib.``System.Console``
let writeLine = console.``WriteLine(string)``
let write = DynamicMethod("write", null, [| typeof<string> |])

#The hacky way of getting VS to provide syntax highlighting for Unity's compute shaders.

  1. Turn off Visual Studio

  2. In C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\VC

As administrator, remove the read-only flag on the file VC_Pkg_Core_Registration.pkgdef, and edit it in a evelated text editor.

  1. Search for .cginc, and for each cginc entry in the file, add a similar entry for .compute. Like this:
diff --git a/src/OmniSharp.MSBuild/MSBuildProjectSystem.cs b/src/OmniSharp.MSBuild/MSBuildProjectSystem.cs
index 3ebdeb9..66c8236 100644
--- a/src/OmniSharp.MSBuild/MSBuildProjectSystem.cs
+++ b/src/OmniSharp.MSBuild/MSBuildProjectSystem.cs
@@ -134,6 +134,12 @@ public void Initalize(IConfiguration configuration)
compilationOptions = compilationOptions.WithAllowUnsafe(true);
}
+ if (projectFileInfo.SignAssembly && !string.IsNullOrEmpty(projectFileInfo.AssemblyOriginatorKeyFile))
+ {
diff --git a/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs b/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs
index 05ab3fb..e55109f 100644
--- a/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs
+++ b/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs
@@ -94,7 +94,6 @@ static void ReadLocalVariables (MethodEntry entry, MethodBody body, Scope [] sco
void ReadLineNumbers (MethodEntry entry, InstructionMapper mapper)
{
- Document document = null;
var table = entry.GetLineNumberTable ();