Skip to content

Instantly share code, notes, and snippets.

View dalexsoto's full-sized avatar

Alex Soto dalexsoto

View GitHub Profile
-> CopyPNGFile
Copies a .png file resource, optionally compressing it.
$ copypng [options] $(IPHONE_OPTIMIZE_OPTIONS) [input] [output]
-> Code Sign
Code-sign a framework, application, or other built target.
$ /usr/bin/codesign
-> Strip Symbols
Remove or modify the symbol table of a Mach-O binary
#!/usr/bin/env ruby
device_types_output = `xcrun simctl list devicetypes`
device_types = device_types_output.scan /(.*) \((.*)\)/
runtimes_output = `xcrun simctl list runtimes`
runtimes = runtimes_output.scan /(.*) \(.*\) \((com.apple[^)]+)\)$/
devices_output = `xcrun simctl list devices`
devices = devices_output.scan /\s\s\s\s(.*) \(([^)]+)\) (.*)/
NSUrl url = new NSUrl (UPLOAD_LOCATION);
NSMutableUrlRequest request = new NSMutableUrlRequest (url);
request.HttpMethod = "POST";
{
// Unfortunately set_HTTPBodyStream isn't implemented in monotouch yet
Selector s = new Selector("setHTTPBodyStream:");
NSInputStream stream = new NSInputStream (random_file_path);
Messaging.void_objc_msgSend_IntPtr (request.Handle, s.Handle, stream.Handle);
@dalexsoto
dalexsoto / ObjectiveCParser.cs
Created November 8, 2011 15:42 — forked from kevinmcmahon/ObjectiveCParser.cs
An Objective C brute force parser from #monotouch irc
// no claim or warranty is made on this code
// it is very brute force
using System;
using System.Collections;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
@dalexsoto
dalexsoto / MojoElement.cs
Created January 31, 2012 16:24
MojoDK MT.Dialog right aligned EntryElement
//
// Elements.cs: defines the various components of our view
//
// Author:
// Miguel de Icaza (miguel@gnome.org)
//
// Copyright 2010, Novell, Inc.
//
// Code licensed under the MIT X11 license
//
//most of the non-declared variables here are at the class level - eg window is:
// UIWindow window
// etc.
window = new UIWindow (UIScreen.MainScreen.Bounds);
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.BlackOpaque;
@dalexsoto
dalexsoto / gist:1893318
Created February 23, 2012 15:33 — forked from nicwise/gist:1889882
Gestures on MT.D
public class BTPinchGestureRecognizer : UIPinchGestureRecognizer
{
public BTPinchGestureRecognizer(NSObject target, Selector action) : base(target, action)
{
ShouldReceiveTouch += (sender, touch) => {
//if (touch.View is UISlider || touch.View is MPVolumeView) return false;
return true;
};
@dalexsoto
dalexsoto / gist:2373563
Created April 13, 2012 03:58
C# function to get the string between 2 strings
//This function gets the string between 2 strings
//Usage
string myString = "<span>Joe Smith</span>";
string [] result = GetStringInBetween("<span>", "</span>", myString);
string output = result[0];
string next = result[1];
//Function
@dalexsoto
dalexsoto / gist:3506454
Created August 29, 2012 03:16
PSPDFKitGlobal
//////////////////////////////////////////
//// PSPDFKitGlobal.h //
//////////////////////////////////////////
public partial class PSPDFKitGlobal
{
private static PSPDFLogLevel _PSPDFLogLevel;
public static PSPDFLogLevel LogLevel
{
get
@dalexsoto
dalexsoto / gist:3539139
Created August 30, 2012 19:49 — forked from Krumelur/gist:3537539
CATransform3D
/// <summary>
/// Sets the anchor point and translates the view so that it stays in its current position.
/// Normally, changing the anchor point also adjusts the view's position.
/// </summary>
/// <param name='oView'>the view whose anchor point has to be modified</param>
/// <param name='oNewAnchorPoint'>the new anchor point</param>
public void SetAnchorPointAndTranslate(PointF oNewAnchorPoint )
{
UIView oView = this;
PointF oNewPoint = new PointF(oView.Bounds.Width * oNewAnchorPoint.X, oView.Bounds.Height * oNewAnchorPoint.Y);