Skip to content

Instantly share code, notes, and snippets.

@d0k
d0k / gist:3608547
Last active February 21, 2022 23:34
clang warning flags
-W
-Wextra
-Wmissing-field-initializers
-Wignored-qualifiers
-Winitializer-overrides
-Wsemicolon-before-method-body
-Wmissing-method-return-type
-Wsign-compare
-Wunused-parameter
-W#pragma-messages
@MarkVillacampa
MarkVillacampa / JavaScriptCore.m
Last active December 27, 2015 19:49
Trying to add methods at runtime for the JSExport protocol in JavaScriptCore. As-is, the method is not called from Javascript. Uncomment lines 7-8 and the end of 11, comment line 65, and run. The method is now called from JavaSript. Any idea why?
#import <Foundation/Foundation.h>
#import <JavaScriptCore/JavaScriptCore.h>
#import <objc/runtime.h>
const char *_protocol_getMethodTypeEncoding(Protocol *, SEL, BOOL isRequiredMethod, BOOL isInstanceMethod);
//@protocol MyProtocol <JSExport>
// -(void)one:(id)one;
//@end
@akisute
akisute / SomeWebViewController.m
Last active July 30, 2018 01:56
Dismissing fullscreen movie player from <video> tag in UIWebView
- (void)exitFullScreenVideo
{
// Works in iOS, not sure in OS X
[self.webView stringByEvaluatingJavaScriptFromString:@"Array.prototype.forEach.call(document.getElementsByTagName('video'),function(v){v.webkitExitFullscreen();});"];
// Didn't work in iOS, works in OS X
[self.webView stringByEvaluatingJavaScriptFromString:@"if(document.webkitFullscreenElement){document.webkitExitFullscreen();}"];
}
@TimOliver
TimOliver / libdsm-ios.sh
Last active June 17, 2021 09:10
The Bash script I use to compile libDSM for iOS
#!/bin/bash
# Global build settings
export SDKPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
export SIMSDKPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
export MIN_IOS_VERSION=7.0
export HOST=arm-apple-darwin
export LDFLAGS_NATIVE="-isysroot $SDKPATH"
export LDFLAGS_SIMULATOR="-isysroot $SIMSDKPATH"
export TASN1_CFLAGS="-Ilibtasn1/include"