Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@leye0
leye0 / infinite-scroll.ts
Created June 28, 2016 13:56
Aurelia Infinite Scroll custom attribute
// Usage: div is the container that wraps your items.
// <div infinite-scroll loadmore.trigger="loadMoreStuff()"></div>
import {autoinject, bindable, DOM} from 'aurelia-framework';
@autoinject()
export class InfiniteScrollCustomAttribute {
element: HTMLInputElement;
onScroll: (event: Event) => void;
@leye0
leye0 / css-loader.ts
Last active June 28, 2016 13:57
Typescript / Aurelia css Loader
export default class CSSLoader {
public static load = (path) => {
let head = document.getElementsByTagName('head')[0];
let link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = path;
link.media = 'all';
head.appendChild(link);
}
@leye0
leye0 / xaml.cs
Created March 21, 2016 18:10 — forked from muojp/xaml.cs
Sketching w/ Xamarin.Forms XAML
using Xamarin.Forms;
using System.Reflection;
using System.Runtime.CompilerServices;
using Xamarin.Forms.Xaml;
var xaml = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
x:Class=""XamlSamples.HelloXamlPage""
Title=""Hello XAML Page""
@leye0
leye0 / FormsBinding.sketchcs.cs
Created March 21, 2016 18:09 — forked from VincentH-Net/FormsBinding.sketchcs.cs
Xamarin Forms Sketch demonstrating data binding (without strings, to nested objects, to unlimited number of fields) and common app/sketch code. Note: remove the .cs from the file name, it is only there to make GitHub format it as C#
using Xamarin.Forms;
// Additional guidance: see http://vincenth.net/blog/archive/2014/11/27/how-to-share-xamarin-forms-data-binding-code-across-xamarin-sketches-and-apps-without-using-strings.aspx
// NOTE: Once support for creating classes is added to Xamarin Sketches,
// there is no need for this Tuple + enum + BindName + regular expression workaround;
// you can then simply create design data classes in the Sketch and bind to that using
// the same syntax in both projects and sketches, e.g.:
// SetBinding(..., (Person boundPerson) => boundPerson.Name)
// BindName helper function for use with binding to design data in Sketches.