Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:components="clr-namespace:AsyncButtonApp.Components"
xmlns:vm="clr-namespace:AsyncButtonApp.ViewModels"
x:Class="AsyncButtonApp.Views.MainPage"
Title="Main Page">
<ContentPage.BindingContext>
<vm:MainPageViewModel />
</ContentPage.BindingContext>
@khle
khle / AsyncButtonControlTemplateResourceDictionary.xaml
Created November 3, 2020 03:32
AsyncButtonControlTemplateResourceDictionary
<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<ControlTemplate x:Key="AsyncButtonControlTemplate">
<Frame CornerRadius="{Binding Source={RelativeSource TemplatedParent},Path=ButtonCornerRadius}"
HasShadow="{Binding Source={RelativeSource TemplatedParent},Path=ButtonHasShadow}"
IsClippedToBounds="{Binding Source={RelativeSource TemplatedParent},Path=ButtonClippedToBounds}"
HorizontalOptions="Center" Padding="0">
<StackLayout BackgroundColor="{Binding Source={RelativeSource TemplatedParent},Path=ButtonBackgroundColor}" Orientation="Horizontal">
<Button Text="{Binding Source={RelativeSource TemplatedParent},Path=ButtonText}" BackgroundColor="{Binding Source={RelativeSource TemplatedParent},Path=ButtonBackgroundColor}"
@khle
khle / AsynButtonView.cs
Created November 3, 2020 03:19
AsynButtonView
using Xamarin.Forms;
namespace AsyncButtonApp.Components
{
public class AsyncButtonView : ContentView
{
public static readonly BindableProperty ButtonCornerRadiusProperty = BindableProperty.Create(nameof(ButtonCornerRadius), typeof(int), typeof(AsyncButtonView), 0);
public static readonly BindableProperty ButtonHasShadowProperty = BindableProperty.Create(nameof(ButtonHasShadow), typeof(bool), typeof(AsyncButtonView), false);
public static readonly BindableProperty ButtonClippedToBoundsProperty = BindableProperty.Create(nameof(ButtonClippedToBounds), typeof(bool), typeof(AsyncButtonView), false);
public static readonly BindableProperty ButtonBackgroundColorProperty = BindableProperty.Create(nameof(ButtonBackgroundColor), typeof(Color), typeof(AsyncButtonView), Color.White);
public static readonly BindableProperty ButtonTextColorProperty = BindableProperty.Create(nameof(ButtonTextColor), typeof(Color), typeof(AsyncButtonView), Color.Black);
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
namespace test
{
class Person
{
public int Number { get; set; }
{%- assign posts = collections.post | reverse -%}
{% for post in posts %}
<span class="badge secondary">{{ post.date | post.date: '%Y-%m-%d' }}</span> [{{ post.data.title }}]({{ post.url }})
{% endfor %}
@khle
khle / layout.njk
Created April 10, 2020 16:03
layout.njk
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/paper.min.css">
<title>{{ title }}</title>
</head>
<body>
@khle
khle / webpack.config.js
Created April 7, 2020 18:41
webpack.config.js
rules: [
{
test: /\.(css|scss)$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1,
modules: {
@khle
khle / header.module.css
Last active April 7, 2020 18:58
Header CSS Module
.logo {
width: 100px;
height: 30px;
background: green;
margin: 16px 28px 16px 0;
float: left;
}
@khle
khle / app.css
Created April 7, 2020 18:00
Global CSS
.logo {
width: 100px;
height: 30px;
background: red;
margin: 16px 28px 16px 0;
float: left;
}
@khle
khle / server.js
Created April 2, 2020 23:15
server.js
const express = require('express');
const path = require("path");
const app = express();
const webpack = require('webpack');
const webpackMiddleware = require('webpack-dev-middleware');
const webpackConfig = require('./webpack.config.js');
app.use(webpackMiddleware(webpack(webpackConfig)));