Skip to content

Instantly share code, notes, and snippets.

View pragmatrix's full-sized avatar

Armin pragmatrix

View GitHub Profile
@pragmatrix
pragmatrix / VirtualKeyHelper.cs
Created August 5, 2012 16:01
(unfinished) Helper to convert WinRT Virtual Keys to ASCII
using System.Diagnostics;
using Windows.System;
namespace Toolbox.WinRT
{
enum VKeyClass
{
Control, // 0-31, 33-47, 91-95, 144-165
Character, // 32, 48-90
NumPad, // 96-111
@pragmatrix
pragmatrix / PhotoExportService.cs
Created September 9, 2012 17:55
ALAssetsLibrary: export to group for MonoTouch, tested on iOS 5.1 - iOS 8.0.2
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using MonoTouch.UIKit;
using MonoTouch.AssetsLibrary;
using MonoTouch.Foundation;
namespace LookHere.Exporting
public interface ISet<ItemT>
{
void Add(ItemT item);
void Remove(ItemT item);
bool Contains(ItemT item);
IEnumerable<ItemT> Items { get; }
int Count { get; }
}
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete.
# Example: git-delete-history path1 path2
if [ $# -eq 0 ]; then
@pragmatrix
pragmatrix / CreateArrowPath.cs
Last active December 22, 2015 02:49
iOS arrow drawing code, ported to MonoTouch / C# from https://gist.github.com/mayoff/4146780
using System;
using System.Drawing;
using MonoTouch.CoreGraphics;
/// https://gist.github.com/mayoff/4146780
static class ArrowPath
{
public static CGPath pathWithArrowFromPoint(
PointF startPoint,
@pragmatrix
pragmatrix / ValueOrException.cs
Last active August 29, 2015 14:02
ValueOrExeption
// see https://gist.github.com/mausch/2ef2e9b26a89d7594e3d
public struct ValueOrException<TValue>
{
public ValueOrException(TValue value, Exception exception)
{
_value = value;
_exception = exception;
}
@pragmatrix
pragmatrix / Entitlements.plist
Created February 24, 2015 14:44
Empty Entitlements.plist
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
[<AutoOpen>]
module Prelude
let (^) = (<|)
type CR = CompilationRepresentationAttribute
let [<Literal>] ModuleSuffix = CompilationRepresentationFlags.ModuleSuffix
type RQA = RequireQualifiedAccessAttribute
let inline flip f a b = f b a
let inline curry f a b = f(a, b)
let [<Literal>] FilenameMaxLen: int = 64
// Note: this is platform dependent, therefore Windows
// version of System.IO.Path.GetInvalidFileNameChars() is hardcoded here.
let InvalidFilenameCharacters = [|
'"'; '<'; '>'; '|'; '\000'; '\001'; '\002'; '\003'; '\004'; '\005'; '\006';
'\007'; '\b'; '\009'; '\010'; '\011'; '\012'; '\013'; '\014'; '\015';
'\016'; '\017'; '\018'; '\019'; '\020'; '\021'; '\022'; '\023'; '\024';
'\025'; '\026'; '\027'; '\028'; '\029'; '\030'; '\031'; ':'; '*'; '?';
'\\'; '/'
Process: physics [44804]
Path: /Users/USER/*/physics
Identifier: physics
Version: 0
Code Type: X86-64 (Native)
Parent Process: zsh [39813]
User ID: 501
Date/Time: 2020-07-27 21:23:03.377 +0200
OS Version: Mac OS X 10.15.5 (19F101)