Skip to content

Instantly share code, notes, and snippets.

View kg's full-sized avatar

Katelyn Gadd kg

View GitHub Profile
protected IEnumerator<object> ShowPauseMenu () {
using (Pause()) {
bool running = true;
while (running) {
var menuItems = new List<object> {
"Resume Game",
"Load Game",
"Save Game",
"Options",
<?xml version="1.0" encoding="utf-8" ?>
<stringtable>
<graph>
<node key="StringTable">
<node key="Controls" />
<node key="Aqueducts_Hint_1" />
<node key="Aqueducts_Hint_4" />
<node key="Aqueducts_Hint_6" />
<node key="Aqueducts_Hint_8" />
@kg
kg / GenericsAndNestedTypes.cs
Created March 20, 2012 14:25
JSIL Code Sample: Generics and Nested Types
using System;
public class Program {
public static void Main (string[] args) {
Console.WriteLine(
Battlestar<object>.instance.commander
);
}
}
@kg
kg / Goto.cs
Created March 20, 2012 14:30
JSIL Code Sample: Goto
using System;
public static class Program {
public static void Main (string[] args) {
int i = 0;
a:
i += 1;
Console.WriteLine("a");
for (; i < 16; i++) {
@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);
@kg
kg / decodeFloat.js
Created March 25, 2012 10:53
Decode 32/64-bit float from bytes in JavaScript
// Derived from http://stackoverflow.com/a/8545403/106786
function decodeFloat(bytes, signBits, exponentBits, fractionBits, eMin, eMax, littleEndian) {
var totalBits = (signBits + exponentBits + fractionBits);
var binary = "";
for (var i = 0, l = bytes.length; i < l; i++) {
var bits = bytes[i].toString(2);
while (bits.length < 8)
bits = "0" + bits;
// Generated by JSIL v0.3.0 build 7255. See http://jsil.org/ for more information.
var $asm00 = JSIL.DeclareAssembly("wwkrcqzi, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
JSIL.MakeEnum(
"CustomEnum", true, {
A: 1,
B: 2
}, false
);
JSIL.MakeStaticClass("Program", true, [], function ($) {
async Task f(CancellationToken cancel)
{
string s1 = await new WebClient().DownloadStringTaskAsync(“http://a.com”, cancel);
string s2 = await new WebClient().DownloadStringTaskAsync(“http://b.com”, cancel);
public class TypeReferenceContext {
public TypeReference EnclosingType;
public TypeReference DefiningType;
public MethodReference EnclosingMethod;
public MethodReference DefiningMethod;
public MethodReference InvokingMethod;
}
/* Generated by JSIL v0.5.0 build 13468. See http://jsil.org/ for more information. */
var $asm01 = JSIL.DeclareAssembly("SimpleRaytracer, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
JSIL.DeclareNamespace("simpleray");
JSIL.MakeClass($asm00.TypeRef("System.Object"), "simpleray.Vector3f", true, [], function ($) {
$.Method({Static:false, Public:true }, ".ctor",
$sig.get(15, null, [
$.Single, $.Single,
$.Single