Skip to content

Instantly share code, notes, and snippets.

View robashton's full-sized avatar
🍻
drinking

His Excellence Sir Professional of Rob upon Ashtonburyshirester robashton

🍻
drinking
View GitHub Profile
@robashton
robashton / CommandHandlerUrlPolicy.cs
Created February 9, 2011 17:42
A working attempt at wrapping ActionCall
public class CommandHandlerUrlPolicy : IUrlPolicy
{
public bool Matches(ActionCall call, IConfigurationObserver log)
{
return call.Method.Name == "Handle";
}
public IRouteDefinition Build(ActionCall call)
{
call = WrapActionCall(call);
@robashton
robashton / gist:874177
Created March 17, 2011 11:25
A naive game loop
function runApplication(){
while(isRunning) {
doLogic();
renderScene();
}
}
@robashton
robashton / gist:874187
Created March 17, 2011 11:33
Another naive game loop
function runApplication(){
setInterval(doGameLoop}, 1000 / 30);
}
function doGameLoop(){
doLogic();
renderScene();
}
var timeAtLastFrame = new Date().getTime();
var idealTimePerFrame = 1000 / 30;
var leftover = 0.0;
var frames = 0;
function runApplication(){
setInterval(tick, 1000/30);
}
function tick() {
Hey,
you seem to be an expert in WebGl.Could you send me a code for super mario game in webgl,written in js?..This has been bugging me for a while,please see if you can help.
@robashton
robashton / Check.cs
Created April 4, 2011 20:42
The model we're analysing
Instruction[] dynamicMethodCalls = ExtractDynamicMethodCallInstructions();
if (dynamicMethodCalls.Length == 0) { return; }
Instruction[] cachedReflectedFields = ExtractInitialReflectedCachedFieldReferenceInstructions();
if (cachedReflectedFields.Length == 0) { return; }
@robashton
robashton / methodssearch.cs
Created April 4, 2011 20:45
Finding the method being loaded
var actualCall = dynamicMethodCalls.Last();
var current = actualCall.Previous;
if(current.OpCode.Code == Code.Ldstr)
{
columnType = typeof (string);
}
@robashton
robashton / gist:929593
Created April 19, 2011 20:38
shader.shader
attribute vec3 aVertexPosition;
attribute vec3 aNormal;
attribute vec2 aTextureCoord;
uniform mat4 uProjection;
uniform mat4 uView;
uniform mat4 uWorld;
uniform mat3 uNormal;
uniform vec3 vLight;
var fs = require('fs');
fs.readFile('hello.txt', function(err, data) {
response.write(data);
response.end();
});
@robashton
robashton / cruft.cs
Created June 13, 2011 16:14
ASP.NET Cruft
[HttpPost]
public ActionResult DoSomethingCool()
{
if (Session["water"] == "boiling")
{
Server.TransferRequest("~/408.aspx");
}
return View();
}