Skip to content

Instantly share code, notes, and snippets.

View asbjornu's full-sized avatar
💭
He's a loathsome offensive brute, yet I can't look away.

Asbjørn Ulsberg asbjornu

💭
He's a loathsome offensive brute, yet I can't look away.
View GitHub Profile
@asbjornu
asbjornu / inline-unit-test.cs
Created February 24, 2014 08:39
Unit test syntax for C#
public class HelloWorld
{
public string Say()
{
return "Hello World!";
}
test
{
void Say_ReturnsHelloWorld()
@asbjornu
asbjornu / case-insensitive.cs
Last active August 29, 2015 13:57
What would C# look like if it was case insensitive?
namespace CaseInsensitive
{
public class Test
{
private readonly string name;
public Test(string name)
{
this.name = name;
}

Keybase proof

I hereby claim:

  • I am asbjornu on github.
  • I am asbjornu (https://keybase.io/asbjornu) on keybase.
  • I have a public key whose fingerprint is C671 0035 5226 586F 63DF 0B80 BC58 62FF 43E5 C36E

To claim this, I am signing this object:

@asbjornu
asbjornu / enforce-unicode.py
Last active August 29, 2015 14:14
Enforce UTF-8 Without BOM In All C# Files
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import os
import glob
import fnmatch
import codecs
from chardet.universaldetector import UniversalDetector
# from http://farmdev.com/talks/unicode/
@asbjornu
asbjornu / gist:1053555
Created June 29, 2011 09:56
IronJS executing UglifyJS results in 'TypeError: 64'
IronJS.UserError: TypeError: 64
at IronJS.Hosting.FSharp.run(Delegate compiled, T t) in D:\AUL\Dev\Misc\IronJS\Src\IronJS\Hosting.fs:line 152
at IronJS.Hosting.CSharp.Context.Execute(String source) in D:\AUL\Dev\Misc\IronJS\Src\IronJS\Hosting.fs:line 240
at Uglify.Uglifier.Uglify(String code) in D:\AUL\Dev\Misc\Uglify.NET\src\app\Uglify\Uglifier.cs:line 28
at Uglify.Terminal.Terminal.Main() in D:\AUL\Dev\Misc\Uglify.NET\src\tests\Terminal\Terminal.cs:line 12
@asbjornu
asbjornu / volume-down.scpt
Created September 10, 2011 13:20
Turn down the volume in OS X by two steps
set volume output volume (get (output volume of (get volume settings)) - 2)
@asbjornu
asbjornu / volume-up.scpt
Created September 10, 2011 13:21
Turn up the volume in OS X by two steps
set volume output volume (get (output volume of (get volume settings)) + 2)
@asbjornu
asbjornu / new-finder-window.scpt
Created September 10, 2011 13:29
Open the home folder in a new Finder window
tell application "Finder"
activate
open (path to home folder)
end tell
@asbjornu
asbjornu / cs-namespace-svn-move.rb
Created December 6, 2011 09:17
Move C# files into namespace folders with Subversion
Dir.glob("*.cs") do | file |
target = file.split('.').map { | segment |
if segment != "cs"
segment
end
}.compact.join('/')
if target.index('Generated')
target['/Generated'] = ''
target = 'Generated/' + target
@asbjornu
asbjornu / argumentexception.txt
Created December 16, 2011 10:50
Mono.Cecil throws ArgumentException on AssemblyDefinition.ReadAssembly()
System.ArgumentException: Value does not fall within the expected range.
at System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(Array array, RuntimeFieldHandle fldHandle)
at Mono.Cecil.Mixin.GetSize(CodedIndex self, Func`2 counter)
at Mono.Cecil.PE.Image.GetCodedIndexSize(CodedIndex coded_index)
at Mono.Cecil.PE.ImageReader.GetCodedIndexSize(CodedIndex index)
at Mono.Cecil.PE.ImageReader.ComputeTableInformations()
at Mono.Cecil.PE.ImageReader.ReadTableHeap()
at Mono.Cecil.PE.ImageReader.ReadMetadata()
at Mono.Cecil.PE.ImageReader.ReadImage()
at Mono.Cecil.PE.ImageReader.ReadImageFrom(Stream stream)