Skip to content

Instantly share code, notes, and snippets.

@dodikk
dodikk / import.mm
Last active August 29, 2015 14:15
Import protocol to coredata
-(void)importMessageFromWebSocket:(id<HJMessage>)singleMessage
{
NSPredicate* findExistingMessage =
[NSPredicate predicateWithFormat: @"(identifier == %@) && (conversation.identifier == %@)",
singleMessage.messageId,
singleMessage.roomId];
NSManagedObjectContext* context = [NSManagedObjectContext MR_contextForCurrentThread];
@dodikk
dodikk / RunXcodebuild.sh
Created February 10, 2015 09:15
Xctool "not configured for the build action"
dodikk$ xcodebuild -workspace HealthJoy_iPhone_UnitTests.xcworkspace -scheme "HealthJoyAuthentication-UnitTest-CI" -sdk iphonesimulator test | tee xcodebuild.log
Build settings from command line:
SDKROOT = iphonesimulator8.1
=== BUILD TARGET HealthJoyAuthentication OF PROJECT HealthJoyAuthentication WITH CONFIGURATION Debug ===
Check dependencies
@dodikk
dodikk / build_commands.sh
Created February 4, 2015 16:21
xcodebuild do-s and don't-s
xcodebuild -workspace XYZ -target xyzApp
## это - хрень. Не делай так
xcodebuild -project XYZ.xcodeproj -scheme abcApp
## это - тоже хрень.
xcodebuild -workspace XYZ -scheme abcApp
## так - нормально, но нужна shared scheme
xcodebuild -project XYZ.xcodeproj -target xyzApp
@dodikk
dodikk / 1.cs
Created January 26, 2015 10:43
On Generic Parameters Naming. Which one is better?
public interface IRestApiCallTasks<TRequest, THttpResult, TResult>
{
Task<string> BuildRequestUrlForRequestAsync( TRequest request );
Task<THttpResult> SendRequestForUrlAsync( string requestUrl );
Task<TResult> ParseResponseDataAsync(THttpResult httpData);
}
@dodikk
dodikk / OnPageSelected.js
Last active August 29, 2015 14:13
Attempting to show a selected div in fullscreen mode but UIWebView does not apply changes
$('#p39485').addClass('overlay');
@dodikk
dodikk / WeakifyExplained.mm
Created December 17, 2014 10:19
Explanation of __weak and __strong keywords
void foo()
{
// __strong guarantees that the object is "alive" until the end of foo() stack frame. The __strong keyword is used implicitly and may be omitted.
// Unless it's retained by other objects
__strong SomeObjectClass *someObject = ...
// __weak does not let the block increase the retain count of "someObject"
//
__weak SomeObjectClass *weakSomeObject = someObject;
@dodikk
dodikk / gist:8bfc07edeb29aadbce69
Created November 29, 2014 19:19
Carthage build
Last login: Sat Nov 29 20:54:14 on ttys008
dodikk-MacBook:Carthage dodikk$ make package
rm -f "Carthage.pkg"
rm -rf "/tmp/Carthage.dst"
xcodebuild -workspace 'Carthage.xcworkspace' -scheme 'carthage' clean
2014-11-29 21:08:34.499 xcodebuild[25139:1007] [MT] DVTSDK: Warning: SDK path collision for path '<DVTFilePath:0x7fb9e2d0f640:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk'>': SDK with name 'iphonesimulator8.1' being superceded by SDK with 'iphonesimulator8.1'.
2014-11-29 21:08:34.502 xcodebuild[25139:1007] [MT] DVTSDK: Warning: SDK path collision for path '<DVTFilePath:0x7fb9e2f36840:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk'>': SDK with name 'iphoneos8.1' being superceded by SDK with 'iphoneos8.1'.
=== CLEAN TARGET LlamaKit-Mac OF PROJECT LlamaKit WITH CONFIGURATION Debug ===
Check dependencies
@dodikk
dodikk / GetLogs.sh
Created November 6, 2014 07:59
iOS simulator logs
tail -f ~/Library/Logs/CoreSimulator/<simulator_id>/system.log | grep <app_name>
@dodikk
dodikk / KillNSObject.mm
Created October 29, 2014 13:24
Как убить объект в Objective-C
// избавляемся от свидетелей
while (object.retainCount) {
[object release];
}
// 146% убиваем объект. Мамом клянусь - да!
[object release];
// контрольный в голову
[object dealloc];
@dodikk
dodikk / AddGitRepo.sh
Created October 6, 2014 10:59
Emulating submodule in svn or other VCS
#!/bin/bash
git clone <myRepo.git>
git checkout <commit hash GUID/tag name/branch name>