Skip to content

Instantly share code, notes, and snippets.

@tomgilder
tomgilder / main.dart
Created September 5, 2022 08:29
TabView zero duration bug
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@tomgilder
tomgilder / main.dart
Created September 5, 2022 08:28
solid-gust-7810
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@tomgilder
tomgilder / count.dart
Created July 2, 2020 07:27
enum counting
void main() {
final words = ['a', 'dog', 'apples', 'supercalifragilisticexpialidocious'];
final lengths = words.map((word) => getWordLength(word));
print("Long words: ${lengths.where((length) => length == WordLength.long).length}");
print("Medium words: ${lengths.where((length) => length == WordLength.medium).length}");
print("Short words: ${lengths.where((length) => length == WordLength.short).length}");
}
@tomgilder
tomgilder / TextViewHtmlExtention.cs
Created July 18, 2016 12:55
Xamarin.Android set HTML in TextVIew extension
public static class TextViewHtmlExtention
{
public static void SetHtml(this TextView textView, string html)
{
textView.SetText(Html.FromHtml(html), TextView.BufferType.Spannable);
}
}
@tomgilder
tomgilder / MainThreadWatchdog.cs
Last active November 9, 2015 23:12
Watchdog to alert when iOS main thread is blocked
using System;
using System.Diagnostics;
using Foundation;
using System.Runtime.InteropServices;
using ObjCRuntime;
namespace Watchdog
{
public static class MainThreadWatchdog
{
#if LAUNCHIMAGE
private void SayCheeseForLaunchImage()
{
UIView statusBar = (UIView) UIApplication.SharedApplication.ValueForKey(new NSString("statusBar"));
UIView foregroundView = (UIView) statusBar.ValueForKey(new NSString("foregroundView"));
foregroundView.Hidden = true;
UILabel.Appearance.TextColor = new UIColor(0, 0, 0, 0);
}
@tomgilder
tomgilder / BufferTouchViewPresenter.cs
Created November 22, 2013 15:03
BufferTouchViewPresenter
using System;
using System.Collections.Generic;
using Cirrious.CrossCore.Exceptions;
using Cirrious.MvvmCross.Touch.Views;
using Cirrious.MvvmCross.Touch.Views.Presenters;
using MonoTouch.UIKit;
namespace ScriptTimer.iOS
{
public class BufferTouchViewPresenter : MvxTouchViewPresenter