Skip to content

Instantly share code, notes, and snippets.

@dodikk
dodikk / CopyTestReports.sh
Created Sep 26, 2012
Copy gh-unit xml reports from simulator sandbox
View CopyTestReports.sh
LAUNCH_DIR=$PWD
cd ../../
PROJECT_ROOT=$PWD
mkdir deployment
cd deployment
DEPLOYMENT_DIR=$PWD
cd "$LAUNCH_DIR"
View testStructAndBlocks.m
-(void)testStructAndBlocks
{
SDRefreshTraits traits_ = { YES, NO };
__block BOOL forceRefresh_ = NO;
TestAsyncRequestBlock block_ = ^( JFFSimpleBlock finishBlock_ )
{
forceRefresh_ = traits_.forceRefresh;
finishBlock_();
@dodikk
dodikk / testStructAndBlocksHeap.m
Created Oct 4, 2012
Check after leaving the stack frame.
View testStructAndBlocksHeap.m
static BOOL forceRefresh_ = NO;
-(TestAsyncRequestBlock)structBlockBuilder
{
SDRefreshTraits traits_ = { YES, NO };
TestAsyncRequestBlock block_ = ^( JFFSimpleBlock finishBlock_ )
{
forceRefresh_ = traits_.forceRefresh;
finishBlock_();
@dodikk
dodikk / testStructChangeAndBlocks.m
Created Oct 4, 2012
Changing the struct after block copy
View testStructChangeAndBlocks.m
-(void)testStructChangeAndBlocks
{
SDRefreshTraits traits_ = { YES, NO };
__block BOOL forceRefresh_ = NO;
TestAsyncRequestBlock block_ = ^( JFFSimpleBlock finishBlock_ )
{
forceRefresh_ = traits_.forceRefresh;
finishBlock_();
View Potential.sql
SELECT * FROM
(
SELECT * FROM
(
SELECT
CASE
WHEN (0 = AllFacetValue) THEN 0
ELSE ( round( ( AverageRelevence - ItemRelevance ) * ItemVisits, 2 ) * 100.0 / AllFacetValue )
END AS Particle,
View BaconFail
describe "Fail test" do
it "always fails" do
(1).should.equal 2
end
end
@dodikk
dodikk / RubymotionTapMallocError
Last active Dec 10, 2015
malloc error in RubyMotion "hello world"
View RubymotionTapMallocError
(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 Dec 15, 2015
Example of iAsync library usage to wrap data acquisition. ( library link : https://github.com/EmbeddedSources/iAsync/ )
View iAsyncDownloadExample.mm
-(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 Mar 21, 2013
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
View ClangWarningsToErrors_xCode.sh
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 Dec 15, 2015
Javascript injection stopped working in iOS 6.1
View gist:5311895
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|