This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('document').ready(() => { | |
let zoom = 1; | |
let nContainer = document.getElementById('container'); // Get zoomed element | |
let originalOffset; // We'll retain original zoomed element offset | |
$(nContainer).draggable(); // Use jQuery UI plugin to make zoomed element draggable | |
$('.zoomable').on('mousewheel', function (e) { | |
e.preventDefault(); | |
let zoomOut = e.originalEvent.deltaY > 0; | |
if ((zoomOut && zoom === 1) || (!zoomOut && zoom === 100)) return; // Ignore action | |
if (!originalOffset) originalOffset = {left: nContainer.offsetLeft, top: nContainer.offsetTop }; // Memorizes original zoomed element offsets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace lol | |
{ | |
public static class ColorHelpers | |
{ | |
public static string GetColorName(Color c) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here’s a simple example of what I’m saying: | |
``` | |
<style> | |
.div1 { | |
overflow-x: hidden; | |
overflow-y: scroll; | |
height: 100px; | |
width: 20px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Little script to add missing source translation into destination translation file so it is easier to maintain | |
// Usage: | |
// add-missing-translations src=en dest=fr | |
const fs = require('fs'); | |
const YAML = require('yaml'); | |
function toKeyValues(args) { | |
return args.map(arg => arg.split('=')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disclaimer: Use bootstrap 4 classes | |
import { Directive, Input, OnInit, ElementRef, Output, EventEmitter, SimpleChanges, OnChanges, HostListener } from '@angular/core'; | |
import { BehaviorSubject } from 'rxjs'; | |
import { debounceTime, filter } from 'rxjs/operators'; | |
const key_arrow_up = 38; | |
const key_arrow_down = 40; | |
const key_enter = 13; | |
@Directive({ |
OlderNewer