Skip to content

Instantly share code, notes, and snippets.

View Jaben's full-sized avatar

Jaben Cargman Jaben

View GitHub Profile
@Jaben
Jaben / designer.html
Created August 12, 2014 02:48
designer
<link rel="import" href="../smoothie-chart/smoothie-chart.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@Jaben
Jaben / Hubs.tt
Last active January 4, 2016 03:19 — forked from htuomola/Hubs.tt
Updated to support generics (1 type parameter currently) and inherited types. Setup for SignalR v1.1.3 -- but just change reference to support SignalR v2.0.
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".d.ts" #>
<# /* Update this line to match your version of SignalR */ #>
<#@ assembly name="$(SolutionDir)\packages\Microsoft.AspNet.SignalR.Core.1.1.3\lib\net40\Microsoft.AspNet.SignalR.Core.dll" #>
<# /* Load the current project's DLL to make sure the DefaultHubManager can find things */ #>
<#@ assembly name="$(TargetPath)" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Web" #>
<#@ assembly name="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
<#@ assembly name="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
@Jaben
Jaben / CamelCaseResponseJsonNetSerializer.cs
Last active December 22, 2015 23:58
camelCase outbound responses for SignalR v1.x.
using System;
using System.IO;
using System.Linq;
using Microsoft.AspNet.SignalR.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
@Jaben
Jaben / durandal\plugins\viewconvention.js
Last active December 20, 2015 19:09
Provides a convention of loading views in modules by looking for the moduleId or moduleIdView case-insensitive. Useful for TypeScript AMD style definition with exports.
define(['exports', 'durandal/system'], function(exports, system) {
var afterDash = function(str) {
var dashIndex = str.lastIndexOf("/", str.length - 1);
return str.substr(dashIndex + 1, str.length - dashIndex);
};
var findPropCaseInsensitive = function(obj, propName) {
var propLower = propName.toLowerCase();
for (var prop in obj) {
@Jaben
Jaben / system.js
Last active December 20, 2015 10:49
Patch to Extend Durandal's v2.0 handling of module exports (AMD) -- specifically make it work with TypeScript AMD exports.
/**
* Resolves the default object instance for a module.
* If the module is a function, that function is called with `new` and it's result is returned.
* If the module is an export object (AMD), a function named '[moduleId]' or '[moduleId]View' created with 'new' and returned.
* If the module is an export object (AMD), a instance named '[moduleId]' or '[moduleId]View' is returned.
* If the module is an object, the instance is returned.
* @method resolveObject
* @param {object} module The module to use to get/create the default object for.
* @return {object} The default object for the module.
*/
@Jaben
Jaben / router.js
Last active December 20, 2015 08:19
Patch to 'Fix' Durandal v1.x Loading in Router.js for TypeScript AMD requireJS.
getActivatableInstance: function (routeInfo, params, module) {
var afterDash = function (str) {
var dashIndex = str.lastIndexOf("/", str.length - 1);
return str.substr(dashIndex+1, str.length - dashIndex);
};
var findPropCaseInsensitive = function(obj, propName) {
propLower = propName.toLowerCase();
for (var prop in obj) {