Skip to content

Instantly share code, notes, and snippets.

@dodikk
dodikk / Solution by @proger
Last active August 29, 2015 14:07
iOS simulator locations
dodikk$ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/simctl list
== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
@dodikk
dodikk / LogicalProjectStructure.txt
Created October 1, 2014 11:41
Mix of cocoapods and manual dependency management
MyWorkspaceAfterPodInstall.xcworkspace
|
|
|---MyApp.xcodeproj
|---|
|---|--target : MyApp.app
|---|
|---|--MyLib.xcodeproj
|---| |
@dodikk
dodikk / AsyncLoadImage.cs
Last active August 29, 2015 14:05
Async image downloading for monotouch
byte[] data = null;
using (Stream response = await session.DownloadResourceAsync(request))
using (MemoryStream responseInMemory = new MemoryStream())
{
await response.CopyToAsync(responseInMemory);
data = responseInMemory.ToArray();
}
BeginInvokeOnMainThread(delegate
{
@dodikk
dodikk / GetPublicKeyTasks.cs
Created May 23, 2014 15:02
REST API flow with Xamarin async
public class GetPublicKeyTasks : IRestApiCallTasks<string, Stream, PublicKeyX509Certificate>
{
public async Task<string> BuildRequestUrlForRequestAsync( string instanceUrl )
{
return await Task.Factory.StartNew ( () => instanceUrl + "/-/item/v1/-/actions/getpublickey" );
}
public async Task<Stream> SendRequestForUrlAsync( string requestUrl )
{
return await this.httpClient.GetStreamAsync(requestUrl);
@dodikk
dodikk / SCRangeSliderViewDelegate.h
Last active August 29, 2015 14:01
iOS UI control localizations and appearance tuning
@protocol SCRangeSliderViewDelegate < NSObject >
#pragma mark - DataSource methods
@required
-(NSUInteger)numberOfSectionsForRangeSliderView:( SCRangeSliderView* )view_;
-(NSUInteger)maxRangeLengthForSliderView:( SCRangeSliderView* )view_;
-(void)didChangeSelectedRangeOfRangeSliderView:( SCRangeSliderView* )view_;
@dodikk
dodikk / BoxingExample.mm
Created May 6, 2014 14:43
Example of code with and without boxing to NSNumber
#import "MUVersionDetector.h"
#define CPP_STRING_LINKER_ERRORS 0
#if !CPP_STRING_LINKER_ERRORS
typedef std::map<std::string, MUApplicationVersion> MUCacheFolderForVersionMap;
typedef MUCacheFolderForVersionMap::const_iterator MUCacheFolderForVersionMap_ci;
#endif
@implementation MUVersionDetector
@dodikk
dodikk / BoyarStyle.cpp
Last active March 31, 2023 00:02
Russian C++
// Боярский языг.cpp : Defines the entry point for the console application.
//
#define и and
#define и_мало_равно and_eq
#define основа asm
#define само auto
#define и_мало bitand
#define или_мало bitor
[DEBUG] Session could not be started:
Error Domain=DTiPhoneSimulatorErrorDomain
Code=1
"The application that opened iOS Simulator failed to send all of the required information (sessionUUID, sdkRoot, deviceInfo)."
UserInfo=0x7f9c09e35890
{
NSLocalizedDescription=The application that opened iOS Simulator failed to send all of the required information (sessionUUID, sdkRoot, deviceInfo).,
@implementation NSArray
-(instancetype)initWithXXX:()
{
NSArray_XXX_Impl* impl = [ NSArray_XXX_Impl new ];
// initialize impl
@protocol MyBlockProtocol;
typedef id<MyBlockProtocol>(^MyFactoryMethodBlock)( NSString* )objectId