Skip to content

Instantly share code, notes, and snippets.

@dodikk
dodikk / CopyTestReports.sh
Created September 26, 2012 09:58
Copy gh-unit xml reports from simulator sandbox
LAUNCH_DIR=$PWD
cd ../../
PROJECT_ROOT=$PWD
mkdir deployment
cd deployment
DEPLOYMENT_DIR=$PWD
cd "$LAUNCH_DIR"
@dodikk
dodikk / testStructAndBlocks.m
Created October 4, 2012 13:46
testStructAndBlocks
-(void)testStructAndBlocks
{
SDRefreshTraits traits_ = { YES, NO };
__block BOOL forceRefresh_ = NO;
TestAsyncRequestBlock block_ = ^( JFFSimpleBlock finishBlock_ )
{
forceRefresh_ = traits_.forceRefresh;
finishBlock_();
@dodikk
dodikk / testStructAndBlocksHeap.m
Created October 4, 2012 14:01
Check after leaving the stack frame.
static BOOL forceRefresh_ = NO;
-(TestAsyncRequestBlock)structBlockBuilder
{
SDRefreshTraits traits_ = { YES, NO };
TestAsyncRequestBlock block_ = ^( JFFSimpleBlock finishBlock_ )
{
forceRefresh_ = traits_.forceRefresh;
finishBlock_();
@dodikk
dodikk / testStructChangeAndBlocks.m
Created October 4, 2012 14:05
Changing the struct after block copy
-(void)testStructChangeAndBlocks
{
SDRefreshTraits traits_ = { YES, NO };
__block BOOL forceRefresh_ = NO;
TestAsyncRequestBlock block_ = ^( JFFSimpleBlock finishBlock_ )
{
forceRefresh_ = traits_.forceRefresh;
finishBlock_();
@dodikk
dodikk / Potential.sql
Created November 25, 2012 09:53
level 5 query
SELECT * FROM
(
SELECT * FROM
(
SELECT
CASE
WHEN (0 = AllFacetValue) THEN 0
ELSE ( round( ( AverageRelevence - ItemRelevance ) * ItemVisits, 2 ) * 100.0 / AllFacetValue )
END AS Particle,
@dodikk
dodikk / BaconFail
Created January 8, 2013 21:41 — forked from anonymous/BaconFail
describe "Fail test" do
it "always fails" do
(1).should.equal 2
end
end
@dodikk
dodikk / RubymotionTapMallocError
Last active December 10, 2015 20:28
malloc error in RubyMotion "hello world"
(in /Users/dodikk/projects/ruby/RubyMotionTestApp-master)
Build ./build/iPhoneSimulator-6.0-Development
Compile ./spec/fail_test.rb
Link ./build/iPhoneSimulator-6.0-Development/HelloMotion_spec.app/HelloMotion
Create ./build/iPhoneSimulator-6.0-Development/HelloMotion_spec.dSYM
Simulate ./build/iPhoneSimulator-6.0-Development/HelloMotion_spec.app
2013-01-08 23:44:15.201 HelloMotion[2228:11303] Application windows are expected to have a root view controller at the end of application launch
HelloMotion(2228,0xacd202c0) malloc: *** error for object 0x8a9a560: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
dodikk-macbook:spec dodikk$ cat result.txt
@dodikk
dodikk / iAsyncDownloadExample.mm
Last active December 15, 2015 02:19
Example of iAsync library usage to wrap data acquisition. ( library link : https://github.com/EmbeddedSources/iAsync/ )
-(void)clientCode
{
JFFAsyncOperation dataLoader_ = [ builder buildDataLoaderWithAuthentication ];
dataLoader_( nil, nil, ^void( id result, NSError* error )
{
// your data is ready. Show it to the user
} );
}
@dodikk
dodikk / ClangWarningsToErrors_xCode.sh
Created March 21, 2013 08:32
This makes xCode fail the build and show analyzer warnings as errors. It is useful when "scan-build" does not work for some reasons. Saved from http://stackoverflow.com/questions/5033417/how-to-treat-warnings-from-clang-static-code-analysis-as-errors-in-xcode-3
error_count=0
##
function verify_clang_analysis_at_path()
{
local analysis_path=$1
local plist_tool=/usr/libexec/PlistBuddy
local diagnostics=$($plist_tool -c "print diagnostics" $analysis_path)
@dodikk
dodikk / gist:5311895
Last active December 15, 2015 19:29
Javascript injection stopped working in iOS 6.1
function createScriptElementWithWebPlugins() {
var headID = document.getElementsByTagName("HEAD")[0];
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.onload=function(){
//scmobile.device.name = 'Igor's iPhone'; // JS interpreter error
scmobile.device.name = unescape( 'Igor%27s%20iPhone' );
alert( scmobile.device.name ); // Shows |Igor's iPhone|