Skip to content

Instantly share code, notes, and snippets.

View macteo's full-sized avatar

Matteo Gavagnin macteo

View GitHub Profile
@macteo
macteo / DocumentViewController.m
Created August 19, 2011 09:35
Support linked documents in FastPdfKit
- (void)documentViewController:(MFDocumentViewController *)dvc didReceiveRequestToGoToDestinationNamed:(NSString *)destinationName ofFile:(NSString *)fileName{
// We set the parameters to the MenuViewController that will open the other document as soon as this one is dismissed
[(MenuViewController *)delegate setLinkedDocument:fileName withPage:-1 orDestinationName:destinationName];
// We need to dismiss the document
[self actionDismiss:nil];
}
@macteo
macteo / Xcode4TestFlightintegration.sh
Created September 19, 2011 07:19 — forked from incanus/Xcode4TestFlightintegration.sh
Xcode 4 scheme Archive step Post-script for automatic TestFlight build uploading. See the blog post here: http://developmentseed.org/blog/2011/sep/02/automating-development-uploads-testflight-xcode
API_TOKEN=<TestFlight API token here>
TEAM_TOKEN=<TestFlight team token here>
SIGNING_IDENTITY="iPhone Distribution: Development Seed"
PROVISIONING_PROFILE="${HOME}/Library/MobileDevice/Provisioning Profiles/MapBox Ad Hoc.mobileprovision"
LOG="/tmp/testflight.log"
DATE=$( /bin/date +"%Y-%m-%d" )
// ARCHIVE=$( /bin/ls -t "${HOME}/Library/Developer/Xcode/Archives/${DATE}" | /usr/bin/grep xcarchive | /usr/bin/sed -n 1p )
ARCHIVE=$( /bin/ls -t "${HOME}/Sviluppo/Archives/${DATE}" | /usr/bin/grep xcarchive | /usr/bin/sed -n 1p )
// APP="${HOME}/Library/Developer/Xcode/Archives/${DATE}/${ARCHIVE}/Products/Applications/${PRODUCT_NAME}.app"
@macteo
macteo / Chat listener
Created November 23, 2011 18:04
Useful to communicate with SiriProxy
- (id) init {
if (self = [super init])
{
[self initNetworkCommunication];
}
return self;
}
- (void) initNetworkCommunication {
@macteo
macteo / Create certificates for SiriProxy
Created November 23, 2011 18:02
Alternative method with openssl
1. openssl genrsa -des3 -out ca.key 4096
2. openssl req -new -x509 -days 365 -key ca.key -out iPhone.crt
3. openssl genrsa -des3 -out server.key 4096
4. openssl req -new -newkey rsa:4096 -nodes -keyout server.key -out server.csr
5. openssl x509 -req -days 365 -in server.csr -CA iPhone.crt -CAkey ca.key -set_serial 01 -out server.passless.crt
6. openssl rsa -in server.key -out server.passless.key
@macteo
macteo / fastpdfkit.md
Created January 4, 2012 17:22
FastPdfKit 3.2

FastPdfKit Update 3.2

Extensions

  • New Extended target that supports Extensions;
  • Out of the box supported Extensions:
    • FPKPayPal to create catalogs with items that can be purchased directly from the app;
    • FPKYouTube to place YouTube video on the page.
    • FPKGallerySlide interactive image gallery with manual or automatic advancement;
    • FPKMap to render an interactive google map;
@macteo
macteo / PSPDFWebViewController.m
Created March 7, 2012 17:48
How to write a pixel perfect backbutton in code. (stuff goes into viewDidLoad). Taken from http://pspdfkit.com
forwardBarButtonItem_ = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(goForward:)];
// back button needs more treatment...
UIGraphicsBeginImageContextWithOptions(CGSizeMake(27, 22), NO, 0.0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColor(context, CGColorGetComponents([UIColor blackColor].CGColor));
CGContextBeginPath(context);
CGContextMoveToPoint(context, 8.0f, 13.0f);
CGContextAddLineToPoint(context, 24.0f, 4.0f);
CGContextAddLineToPoint(context, 24.0f, 22.0f);
@macteo
macteo / receipt
Created June 26, 2012 10:31 — forked from sauloarruda/receipt
Apple iOS in app purchase validate receipt in Ruby
ewoJInNpZ25hdHVyZSIgPSAiQXBNVUJDODZBbHpOaWtWNVl0clpBTWlKUWJLOEVk
ZVhrNjNrV0JBWHpsQzhkWEd1anE0N1puSVlLb0ZFMW9OL0ZTOGNYbEZmcDlZWHQ5
aU1CZEwyNTBsUlJtaU5HYnloaXRyeVlWQVFvcmkzMlc5YVIwVDhML2FZVkJkZlcr
T3kvUXlQWkVtb05LeGhudDJXTlNVRG9VaFo4Wis0cFA3MHBlNWtVUWxiZElWaEFB
QURWekNDQTFNd2dnSTdvQU1DQVFJQ0NHVVVrVTNaV0FTMU1BMEdDU3FHU0liM0RR
RUJCUVVBTUg4eEN6QUpCZ05WQkFZVEFsVlRNUk13RVFZRFZRUUtEQXBCY0hCc1pT
QkpibU11TVNZd0pBWURWUVFMREIxQmNIQnNaU0JEWlhKMGFXWnBZMkYwYVc5dUlF
RjFkR2h2Y21sMGVURXpNREVHQTFVRUF3d3FRWEJ3YkdVZ2FWUjFibVZ6SUZOMGIz
SmxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1CNFhEVEE1TURZeE5U
SXlNRFUxTmxvWERURTBNRFl4TkRJeU1EVTFObG93WkRFak1DRUdBMVVFQXd3YVVI
@macteo
macteo / instructions
Created October 22, 2013 09:06
Build and install libv8 on 10.9 Mavericks, needed to run TheRubyRacer.
Gist from [here](http://stackoverflow.com/questions/19270108/therubyracer-error-error-while-executing-gem-nomethoderror-undefined-meth)
git clone https://github.com/cowboyd/libv8.git
cd libv8
bundle install
bundle exec rake checkout
bundle exec rake compile
bundle exec rake build
gem install ./pkg/libv8-3.16.14.3.gem
@macteo
macteo / update
Created July 21, 2016 07:47
update pods and bottles
#!/bin/bash
brew update
brew upgrade
brew cleanup
gem update
gem cleanup

Keybase proof

I hereby claim:

  • I am macteo on github.
  • I am macteo (https://keybase.io/macteo) on keybase.
  • I have a public key ASAkq8lIePpI-kKfcPDyOoGxmWwYD-kePJD2_VdgC8XACgo

To claim this, I am signing this object: