Skip to content

Instantly share code, notes, and snippets.

View dalexsoto's full-sized avatar

Alex Soto dalexsoto

View GitHub Profile
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);
using System;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.AudioToolbox;
using MonoTouch.CoreGraphics;
namespace GoogleMusic
{
public class LevelMeter : UIView
{
@nicwise
nicwise / gist:1319168
Created October 27, 2011 09:35
Scroll view stuff
float pageControlHeight = 18.0f;
UIScrollView scrollView;
UIPageControl pageControl;
public void BuildAndReloadUI(List<Marker> markers, int favCount)
{
Util.TurnOffNetworkActivity();
CleanView();
@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;
//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;
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;
};
@yamaya
yamaya / xcode-clang-vers
Last active April 3, 2024 02:28
Xcode clang version record
# Xcode 4.3.3
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
# Xcode 4.3.2
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
@m14t
m14t / fix_github_https_repo.sh
Created July 5, 2012 21:57
Convert HTTPS github clones to use SSH
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi
@Krumelur
Krumelur / gist:3537539
Created August 30, 2012 18:54
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);
@nicwise
nicwise / gist:3656362
Created September 6, 2012 13:40
utils class
using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.Dialog;
using System.IO;
using MonoTouch.MessageUI;
using System.Threading;
using MonoTouch.ObjCRuntime;
using System.Globalization;
using System.Xml.Linq;