Skip to content

Instantly share code, notes, and snippets.

View bennage's full-sized avatar
📺
please stay tuned

Christopher Bennage bennage

📺
please stay tuned
View GitHub Profile
@bennage
bennage / app.html
Created December 8, 2012 02:15
bootstrapping my game
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>sidera</title>
<link href="/css/default.css" rel="stylesheet" />
<script src="requestAnimationFrameShim.js"></script>
<script src="bootstrap.js"></script>
@bennage
bennage / require.specs.js
Created June 19, 2012 04:37
specs for a _simple_ 'require' function; used for managing dependencies in WinJS app (using Jasmine)
describe('The require function (or service locator)', function () {
beforeEach(function () {
});
it('should exist', function () {
expect(require).toBeDefined();
});
it('should return the Windows object when passed "Windows"', function () {
@bennage
bennage / github.spike.js
Created March 19, 2012 07:24
downloading the contents of a repo
var assert = require('assert');
var https = require('https');
var fs = require('fs');
var repo = '/login/repo-name/';
var output_path = './a/folder';
function https_get(options, success) {
return https.get(options, function(res) {
if (res.statusCode !== 200) {
@bennage
bennage / NormalizeLineEndings.cs
Created March 16, 2012 22:43
quick and dirty for normalizing all the line endings in project (curse you autocrlf!)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
namespace NormalizeLineEndings
{
internal class Program
{
@bennage
bennage / math.rb
Created September 29, 2011 03:57
Adah's First Ruby Script
# adah's first program
puts 'what is the number to divide?'
x=gets.to_i
puts 'what do you want to divide it by?'
y=gets.to_i
puts 'here is the answer.'
puts x/y
r=x%y
if r != 0 then
@bennage
bennage / ezekiel.cs
Created July 27, 2011 05:15
a console app for Windows that monitors changes to a directory and restarts node.js for me
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace ezekiel
{
class Program
@bennage
bennage / jslint-helper-for-wsh.js
Created April 26, 2011 07:20
a script for executing jslint on a command line in Windows. Execute with: cscript.exe jslint-helper-for-wsh.js file-to-test.js
/*jslint evil: true, white: true, onevar: true, undef: true, nomen: true, regexp: true, plusplus: true, bitwise: true, newcap: true, maxerr: 10, indent: 4 */
/*global JSLINT, WScript, ActiveXObject, Enumerator*/
(function () {
var jslint_path = 'jslint.js',
jslint_source = '',
utf8 = '',
fso = new ActiveXObject('Scripting.FileSystemObject'),
files = [],
args = WScript.Arguments;
@bennage
bennage / Can_insert_async_and_get_sync.cs
Created January 17, 2011 15:43
example of a Raven client test on the .NET side
[Fact]
public void Can_insert_async_and_get_sync()
{
using (var server = GetNewServer(port, path))
{
var documentStore = new DocumentStore { Url = "http://localhost:" + port };
documentStore.Initialize();
var entity = new Company { Name = "Async Company" };
using (var session = documentStore.OpenAsyncSession())
@bennage
bennage / AsyncDocumentStoreServerTests.cs
Created January 15, 2011 22:19
improved syntax for Raven's Silverlight unit tests
namespace Raven.Tests.Silverlight
{
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Client.Document;
using Client.Extensions;
using Database.Data;
using Database.Indexing;
using Document;
@bennage
bennage / pattern-matching.fs
Created November 19, 2010 20:08
a simple example of pattern matching in F#
type Shape =
| Circle of float
| Rectangle of double*double
| EquilateralTriangle of double
let pi = 3.141592654
let area shape =
match shape with
| Circle r -> r*r*pi