Skip to content

Instantly share code, notes, and snippets.

View beyond-code-github's full-sized avatar

Pete Smith beyond-code-github

View GitHub Profile
@beyond-code-github
beyond-code-github / HelloWorldModule.cs
Created September 20, 2013 12:25
HelloWorldModule with parameter capture
namespace WebApiModuleHelloWorld
{
using Superscribe.Models;
public class HelloWorldModule : Superscribe.WebApi.Modules.SuperscribeModule
{
public HelloWorldModule()
{
this.Get["/"] = _ => "Hello World!";
using System.Web.Http;
namespace WebApiModuleHelloWorld
{
using Superscribe.WebApi;
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
namespace WebApiModuleHelloWorld
{
public class HelloWorldModule : Superscribe.WebApi.Modules.SuperscribeModule
{
public HelloWorldModule()
{
this.Get["/"] = _ => "Hello World!";
}
}
}
@beyond-code-github
beyond-code-github / sample.cs
Last active December 23, 2015 12:39
Hello world nancy
public class SampleModule : Nancy.NancyModule
{
public SampleModule()
{
Get["/"] = _ => "Hello World!";
}
}
@beyond-code-github
beyond-code-github / Program.cs
Last active December 21, 2015 04:48
West London Hack Night - Reworked Brainfuck interpreter in C#
namespace BrainFuckContinued
{
using System;
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
var p = "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.";
@beyond-code-github
beyond-code-github / gist:5564201
Created May 12, 2013 16:51
Final version of the getData function
// Button click function
model.getData = function () {
var skip = model.pageSize() * (model.currentPage() - 1);
$.get("/api/values?$top=" + model.pageSize() + "&$skip=" + skip + "&$inlinecount=allpages", function (data) {
model.count(data.Count);
model.records(data.Results);
});
};
@beyond-code-github
beyond-code-github / gist:5564047
Created May 12, 2013 16:11
Javascript for Linq to Querystring paging sample
// Define the viewmodel
var model = {};
model.records = ko.observableArray();
model.count = ko.observable(0);
model.currentPage = ko.observable(1);
model.pageSize = ko.observable(5);
model.pages = ko.computed(function () {
var pages = [];
@beyond-code-github
beyond-code-github / gist:5564031
Created May 12, 2013 16:07
Linq to Querystring paging sample - Index.cshtml
<div id="body">
<section class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1>Paging with Linq to Querystring</h1>
</hgroup>
<p>
Look how easy it is to page data with OData and Linq to Querystring!
</p>
</div>
@beyond-code-github
beyond-code-github / WebApiConfig.cs
Last active December 17, 2015 06:09
Removal of the XML formatter
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
var xmlFormatter = config.Formatters.XmlFormatter;
config.Formatters.Remove(xmlFormatter);
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
@beyond-code-github
beyond-code-github / ValuesController.cs
Last active December 17, 2015 06:09
Initial values controller
namespace LinqToQuerystringPagingSample.Controllers
{
using System.Linq;
using System.Web.Http;
public class ValuesController : ApiController
{
// GET api/values
public IQueryable<string> Get()
{