Skip to content

Instantly share code, notes, and snippets.

@johnnyelwailer
johnnyelwailer / designer.html
Last active August 29, 2015 14:06
designer
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../topeka-elements/theme.html">
<link rel="import" href="../topeka-elements/topeka-resources.html">
<link rel="import" href="../topeka-elements/topeka-app.html">
<polymer-element name="my-element">
@johnnyelwailer
johnnyelwailer / keyboard_navigation_service.js
Last active July 6, 2016 10:47
keyboard navigation directive / service in angular js (depends on jq and rxjs)
angular.module('keyboard', [])
.factory('keyboardNavigation', function () {
var keyboardContextStack = [];
var navigatables = {};
var activeIndex = 0;
return {
active: null,
register: function (scope, events) {
@johnnyelwailer
johnnyelwailer / ReactiveCollectionView.cs
Created April 24, 2012 08:33
A version of ObservableCollectionView that inherits from ReactiveCollection
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using ReactiveUI;
public class ReactiveCollectionView<T> : ReactiveCollection<T>, IList<T>
@johnnyelwailer
johnnyelwailer / gist:1293236
Created October 17, 2011 17:44
css fluid item adding
@-webkit-keyframes ani-insert {
0% {
opacity: 0;
-webkit-transform: translate(0px,-30px);
width: 0;
}
10% {
opacity: 0;
width: 20px;
@johnnyelwailer
johnnyelwailer / DependencyObservation.cs
Created September 13, 2011 11:12
prototype implementation of DependencyObservation.
/// <summary>Provides a way to define bindings and their values in an intuitive way.</summary>
public static class DependencyObservation
{
/// <summary>Creates a dependency observer of the specified instance.</summary>
/// <typeparam name="T">the type of the isntance</typeparam>
/// <typeparam name="TContextProp">The type of the context prop.</typeparam>
/// <param name="instance">The instance.</param>
/// <param name="contextProperty">The context property.</param>
/// <returns>the dependency observer</returns>
public static DependencyObservation<T, TContextProp> Of<T, TContextProp>(T instance, Expression<Func<T, TContextProp>> contextProperty) where T : ReactiveObject
@johnnyelwailer
johnnyelwailer / DependencyObservation.cs
Created September 13, 2011 06:57
Sample of using DependencyObsevation. letting the viewmodel know the dependencies of a property (calling RaisePropertyChanged when those change)
public string FullName
{
get
{
using (var obs = DependencyObservation.Of(this, @this => @this.FullName))
{
return obs.Follow(@this => @this.FirstName) + obs.Follow(@this => @this.LastName);
}
}
}