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
#!/bin/bash | |
read -r -d '' script <<'EOF' | |
on run argv | |
tell application "iTerm" | |
activate | |
set myterm to (make new terminal) | |
tell myterm | |
launch session "Default" | |
tell the last session | |
repeat with arg in argv |
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
// https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtPropertyIntrospection.html#//apple_ref/doc/uid/TP40008048-CH101 | |
public static bool Property(Type clsType, string propertyName, Type encodeType) | |
{ | |
// far from perfect, but prevents "some" brain-farts and misuse... | |
// This should fixed to allow non-wrapped NSValue types (CGRect/Size, etc... consult Appendix C / Key-Value Coding Extensions) | |
if (!(encodeType.IsSubclassOf(typeof(NSObject)) || encodeType.IsValueType)) | |
{ | |
// Eric Lippert's comment: https://stackoverflow.com/questions/2742276/how-do-i-check-if-a-type-is-a-subtype-or-the-type-of-an-object#comment2771730_2742288 | |
throw new Exception("Only NSObject subclasses and Value types supported"); | |
} |
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 MonoMac.Foundation; | |
using MonoMac.AppKit; | |
namespace StatusMenu | |
{ | |
[Register("AppController")] | |
public partial class AppController : NSObject | |
{ | |
public AppController() |
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
// DroidParts is under Apache License 2.0 | |
// https://github.com/droidparts/droidparts/blob/master/droidparts-misc/src/org/droidparts/widget/ClearableEditText.java | |
public class ClearableEditText : EditText, View.IOnTouchListener, View.IOnFocusChangeListener, ITextWatcher | |
{ | |
public ClearableEditText(IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer) : base(javaReference, transfer) { Initialize(); } | |
public ClearableEditText(Context context) : base(context) { Initialize(); } | |
public ClearableEditText(Context context, Android.Util.IAttributeSet attrs) : base(context, attrs) { Initialize(); } | |
public ClearableEditText(Context context, Android.Util.IAttributeSet attrs, int defStyleAttr) : base(context, attrs, defStyleAttr) { Initialize(); } | |
public ClearableEditText(Context context, Android.Util.IAttributeSet attrs, int defStyleAttr, int defStyleRes) : base(context, attrs, defStyleAttr, defStyleRes) { Initialize(); } |
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 (c) 2013-2015 Frank A. Krueger | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// |
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
public class ColorReplaceFilter : CIFilter | |
{ | |
const string filterName = "colorReplace"; | |
const int numArgs = 4; | |
const string coreIageShaderProgram = | |
@" | |
kernel vec4 main(__sample s, __color o, __color r, float threshold) { | |
vec4 diff = s.rgba - o; | |
float distance = length( diff ); | |
float alpha = compare( distance - threshold, 0.0, 1.0 ); |
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
//var bundleUrl = NSBundle.MainBundle.GetUrlForResource("anemone_coralmorphologic", "mp4"); | |
var bundleUrl = NSBundle.MainBundle.GetUrlForResource("addf8-Alaw-GW", "wav"); | |
var asset = AVAsset.FromUrl(bundleUrl); | |
foreach (var fileType in Enum.GetValues(typeof(AVFileTypes))) | |
{ | |
foreach (var preset in AVAssetExportSession.AllExportPresets) | |
{ | |
var UTIConstant = ((AVFileTypes)(Enum.Parse(typeof(AVFileTypes), fileType.ToString()))).GetConstant(); | |
var ok = await AVAssetExportSession.DetermineCompatibilityOfExportPresetAsync( | |
preset, |
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
Task("AssemblyInfoRewrite") | |
.Does (() => | |
{ | |
var assemblyInfoSettings = JsonConvert.DeserializeObject<AssemblyInfoSettings>( | |
JsonConvert.SerializeObject( | |
ParseAssemblyInfo("./CommonAssemblyInfo.cs") | |
) | |
); | |
assemblyInfoSettings.Company = "My Wicked New Company"; | |
CreateAssemblyInfo("./NewCommonAssemblyInfo.cs", assemblyInfoSettings); |
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
// Obtaining the subnet mask of network interfaces on Xamarin.iOS and Xamarin.Mac | |
// | |
// On Xamarin.iOS and Xamarin.Mac, `NetworkInterface.OperationalStatus` always | |
// returns: `OperationalStatus.Unknown` | |
// https://github.com/mono/mono/blob/f48ceb9860676c342f4c91fbc2e34ea600d839c6/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs#L552-L556 | |
// | |
// Additionally, on all "Linux-like" platforms, including iOS and Mac, | |
// `UnicastIPAddressInformation.IPv4Mask` is not implemented | |
// https://github.com/mono/mono/blob/f48ceb9860676c342f4c91fbc2e34ea600d839c6/mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformation.cs#L165-L167 | |
// |
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 Foundation; | |
using UIKit; | |
using TwinCoders.TouchUtils.Extensions; | |
using CoreGraphics; | |
namespace SalesForce.Touch.Views | |
{ | |
public abstract partial class ParentViewController | |
{ |
NewerOlder