View xcodeRun.scpt
tell application id "com.apple.dt.Xcode"
activate
end tell
tell application "System Events"
tell process "Xcode"
click menu item "Run" of menu "Product" of menu bar item "Product" of menu bar 1
end tell
View timeElapsed.cs
void LoadHeavyData()
{
// start timer
float startTime = Time.realtimeSinceStartup;
// sample heavy code...
[...]
// stop timer
float endTime = Time.realtimeSinceStartup;
View Unity2DRotateZ.cs
using UnityEngine;
using System.Collections;
public class Rotate : MonoBehaviour
{
public GameObject objectToRotate;
public GameObject rotationOverlay; // optional
void OnMouseDrag ()
{
View aruba-ftp-upload.sh
#
#ARUBA FTP FILE UPLOAD USING CURL
#
pasky$ curl -v -T uploadme.dat ftp://ftp.site.com/www.site.com/_backup/ --user username:p4ssw0rd
View contentTypeForImageData
- (NSString *)contentTypeForImageData:(NSData *)data {
uint8_t c;
[data getBytes:&c length:1];
switch (c) {
case 0xFF:
return @"jpeg";
case 0x89:
return @"png";
case 0x47:
View archiveIPA.sh
#!/bin/sh
xcodebuild -scheme AppName clean archive -archivePath /Users/pasky/Desktop/AppName
xcodebuild -exportArchive -exportFormat ipa -archivePath "/Users/pasky/Desktop/AppName.xcarchive" -exportPath "/Users/pasky/Desktop/AppName.ipa" -exportProvisioningProfile "XC Ad Hoc: com.AppName.iphone.app"
rm -rf "/Users/pasky/Desktop/AppName.xcarchive"
mv "/Users/pasky/Desktop/AppName.ipa" "/Volumes/DATA/Dropbox/Public/AppName.ipa"
echo "done."
View Execution-Time.m
NSDate *_start;
- (void) start
{
_start = [NSDate date];
}
- (void) stopMethod:(NSString*)pMethod line:(int)pLine
{
View UIDynamics-CCMotionManager.m
//
// ViewController.m
// DynamicMotion
//
// Created by Alberto Pasca on 20/05/15.
// Copyright (c) 2015 Alberto Pasca. All rights reserved.
//
#import "ViewController.h"
#import <CoreMotion/CoreMotion.h>
View APLogger.h
//
// APLogger.h
// Copyright (c) 2015 Alberto Pasca. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface APLogger : NSObject
void APLog ( NSString* format, ... );
View PHP Singleton
<?php
class MyClass
{
private static $instance = null;
private function __construct() { }
public static function getInstance()
{
if(self::$instance == null)
{