Skip to content

Instantly share code, notes, and snippets.

View ArthurHub's full-sized avatar

Arthur ArthurHub

View GitHub Profile
@ArthurHub
ArthurHub / AndroidManifest.xml
Last active July 17, 2017 11:43
Asynchronous Android Crop Camera Image with Custom Progress UI
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.example.arthu.testandroidcropper"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@ArthurHub
ArthurHub / AndroidManifest.xml
Last active January 20, 2022 11:14
Android Crop Camera Image
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.example.arthu.testandroidcropper"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
/// <summary>
/// HTML syntax highlighting using Rich-Text formatting.<br/>
/// - Handle plain input or already in RTF format.<br/>
/// - Handle if input already contains RTF color table.<br/>
/// - Rich coloring adjusted to Visual Studio HTML coloring.<br/>
/// - Support to provide custom colors.<br/>
/// - High performance (as much as RTF format allows).<br/>
/// </summary>
/// <remarks>
/// The MIT License (MIT) Copyright (c) 2014 Arthur Teplitzki.<br/>
public class Test
{
private const int BaseIterations = 3;
private const int RenderIterations = 10000;
private const string TestString = "Test-s.tri,ng m(g=j{}3)";
private static readonly Font _font1 = new Font("Arial", 11);
// private static readonly Font _font1 = new Font("Segoe UI", 9);
// private static readonly Font _font1 = new Font("Tahoma", 10);
// private static readonly Font _font1 = new Font("Microsoft Sans Serif", 9);
@ArthurHub
ArthurHub / ClipboardHelper.cs
Last active June 21, 2023 07:50
Helper class for setting HTML and plain text formatting to clipboard (http://theartofdev.com/2014/06/12/setting-htmltext-to-clipboard-revisited/)
/// <summary>
/// Helper to encode and set HTML fragment to clipboard.<br/>
/// See http://theartofdev.com/2014/06/12/setting-htmltext-to-clipboard-revisited/.<br/>
/// <seealso cref="CreateDataObject"/>.
/// </summary>
/// <remarks>
/// The MIT License (MIT) Copyright (c) 2014 Arthur Teplitzki.
/// </remarks>
public static class ClipboardHelper
{
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ output extension=".cs" encoding="UTF8" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Xml" #>
<#@ assembly name="System.Xml.Linq" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Xml" #>
<#@ import namespace="System.Xml.Linq" #>
<#
//
/// <summary>
/// Wrapper for GDI text rendering functions<br/>
/// This class is not thread-safe as GDI function should be called from the UI thread.
/// </summary>
/// <remarks>
/// http://theartofdev.com/2013/08/12/using-native-gdi-for-text-rendering-in-c/<br/>
/// The MIT License (MIT) Copyright (c) 2014 Arthur Teplitzki.
/// </remarks>
public sealed class NativeTextRenderer : IDisposable
{