Skip to content

Instantly share code, notes, and snippets.

@praeclarum
praeclarum / Layout.cs
Created March 16, 2013 05:23
A C# syntax for NSLayoutConstraints.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using MonoTouch.UIKit;
namespace Async.iOS
{
public static class Layout
{
@jamesmontemagno
jamesmontemagno / MvxUIRefreshControl
Created August 23, 2013 19:36
MvvmCross Implementation of UIRefreshControl that you can use inside of TableViews or CollectionViews
using System;
using MonoTouch.UIKit;
using System.Windows.Input;
namespace com.refractored.mvxbindings
{
/// <summary>
/// Mvx user interface refresh control.
/// </summary>
public class MvxUIRefreshControl : UIRefreshControl
@jamesmontemagno
jamesmontemagno / IRemove.cs
Last active November 16, 2021 08:46
A simple and Intuitive Xamarin.iOS + MvvmCross TableView swipe to delete implementation. This will allow you to have any number of ViewModels simply implement IRemove.cs and all you need is MvxDeleteStandarTableViewSource and implement the interface in your viewmodels! I should say that these are edited classes, you should implement some of the …
public interface IRemove
{
ICommand RemoveCommand { get; }
}
@redent
redent / ParentViewController.Keyboard.cs
Last active May 2, 2018 21:47
Parent view controller to handle keyboard notifications to center views in the screen. UIScrollView related methods moved to an extension class.
using System;
using Foundation;
using UIKit;
using TwinCoders.TouchUtils.Extensions;
using CoreGraphics;
namespace SalesForce.Touch.Views
{
public abstract partial class ParentViewController
{
@jamesmontemagno
jamesmontemagno / MvxSwipeRefreshLayout.cs
Last active April 8, 2019 13:03
MvvmCross Implementation of SwipleRefreshLayout for Xamarin.Android
public class MvxSwipeRefreshLayout : SwipeRefreshLayout
{
/// <summary>
/// Gets or sets the refresh command.
/// </summary>
/// <value>The refresh command.</value>
public ICommand RefreshCommand { get; set;}
public MvxSwipeRefreshLayout(Context context, IAttributeSet attrs)
: base(context, attrs)
public override void OnActivated (UIApplication application)
{
//When your app is backgrounded, iOS takes a snapshot.
//When the app comes back from the background it shows this snapshot at launch until your app is ready
//Sometimes apple forgets to remove the splash screen.
//Your app is in the forground and working. To prove it you can rotate, and see half your real screen.
//To prevent this from happening you can manually remove the view
foreach (var w in application.Windows) {
if (w != null && w != window) {
@DanDiplo
DanDiplo / JS-LINQ.js
Last active July 19, 2024 03:02
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version):
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },