Skip to content

Instantly share code, notes, and snippets.

View rogersillito's full-sized avatar
🔩
Milling

Roger Sillito rogersillito

🔩
Milling
View GitHub Profile
@rogersillito
rogersillito / knockout.simpleGrid.amd.3.0.js
Last active May 13, 2020 14:50
A version of the knockout.simpleGrid binding that works in amd (e.g. requirejs). It uses DOM append instead of document.write().
define(['knockout'], function(ko) {
'use strict';
// adapted from: https://github.com/knockout/knockout/blob/gh-pages/examples/resources/knockout.simpleGrid.3.0.js
// Private function
function getColumnsForScaffolding(data) {
if ((typeof data.length !== 'number') || data.length === 0) {
return [];
}
var columns = [];
@rogersillito
rogersillito / index.html
Last active November 20, 2015 16:15
knockout.js: toggle/toggleable components
<!DOCTYPE html>
<html>
<head>
<script src="
https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.0/knockout-debug.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
@rogersillito
rogersillito / index.html
Created November 17, 2015 17:30
knockout.js: experimenting with bindings (css, checked, textInput, if)
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
@rogersillito
rogersillito / index.html
Created November 16, 2015 14:35
Knockout.js: Experminting with binding context variables
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div data-bind="foreach: teams">
@rogersillito
rogersillito / index.html
Created November 14, 2015 21:39
knockout.js: experimenting with custom binding handlers
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"></script>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
h1 { display: block; }
</style>
@rogersillito
rogersillito / CustomBootstrapper.cs
Created May 19, 2015 12:48
A test web project to show unexpected behaviour in Nancy.FlashMessages when setting messages between http requests
using Nancy;
using Nancy.Bootstrapper;
using Nancy.Conventions;
using Nancy.FlashMessages;
using Nancy.Session;
using Nancy.TinyIoc;
namespace NancyFlashTestHarness
{
public class CustomBootstrapper: DefaultNancyBootstrapper
@rogersillito
rogersillito / RavenTestEmbeddedVsServerWithProfiling.cs
Last active July 14, 2017 16:41
Comparison (inc. log4net profiling) of unit testing a class using a RavenDb IDocumentSession: in-memory embeddable vs locally-hosted RavenDb instance
using log4net;
using NUnit.Framework;
using Raven.Abstractions.Data;
using Raven.Client;
using Raven.Client.Document;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
using Raven.Client.Listeners;
namespace RavenTesting