Block properties
@property (nonatomic, copy) void (^myBlock)(void);
@property (nonatomic, copy) void (^myBlock)(NSString *parameter);
Block variables
void (^myBlock)() = ^()
{
NSLog(@"Do something");
| <html> | |
| <head> | |
| <title>Token viewer</title> | |
| <style> | |
| body { | |
| text-align:center; | |
| font-family:'Helvetica Neue'; | |
| } | |
| </style> | |
| </head> |
Block properties
@property (nonatomic, copy) void (^myBlock)(void);
@property (nonatomic, copy) void (^myBlock)(NSString *parameter);
Block variables
void (^myBlock)() = ^()
{
NSLog(@"Do something");
| ## | |
| ## Shell script to batch convert all files in a directory to caf sound format for iPhone | |
| ## Place this shell script a directory with sound files and run it: 'sh afconvert_wavtocaf.sh' | |
| ## | |
| ## If only converting one then: | |
| ## afconvert -f caff -d ima4 FILENAME.WAV | |
| ## | |
| ## Via http://stackoverflow.com/questions/8769851/convert-multiple-wav-to-caf | |
| for f in *.wav; do |
| #!/bin/sh | |
| KEYWORDS="TODO:|VERIFY:|FIXME:|\?\?\?:|\!\!\!:" | |
| find "${SRCROOT}" -not -path "${SRCROOT}/Pods/*" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/" |
| require 'zlib' | |
| require 'stringio' | |
| # Connect to the bucket and create the file | |
| s3 = AWS::S3.new(access_key_id: 'S3_ACCESS_KEY', secret_access_key: 'S3_SECRET_KEY', region: 'S3_REGION') | |
| bucket = s3.buckets['S3_BUCKET'] | |
| file = bucket.objects.create('S3_FILE_NAME', '') | |
| # Set the content type and encoding. This is the important bit | |
| options = {:acl => :public_read, :content_type => 'application/json', :content_encoding => 'gzip'} |
| // Remember to @import WebKit at the top of the class | |
| // Javascript that disables pinch-to-zoom by inserting the HTML viewport meta tag into <head> | |
| NSString *source = @"var meta = document.createElement('meta'); \ | |
| meta.name = 'viewport'; \ | |
| meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'; \ | |
| var head = document.getElementsByTagName('head')[0];\ | |
| head.appendChild(meta);"; | |
| WKUserScript *script = [[WKUserScript alloc] initWithSource:source injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES]; |
| // Remember to @import WebKit at the top of the class | |
| // Javascript that disables pinch-to-zoom by inserting the HTML viewport meta tag into <head> | |
| let source: NSString = "var meta = document.createElement('meta');" + | |
| "meta.name = 'viewport';" + | |
| "meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no';" + | |
| "var head = document.getElementsByTagName('head')[0];" + | |
| "head.appendChild(meta);"; | |
| let script: WKUserScript = WKUserScript(source: source, injectionTime: .AtDocumentEnd, forMainFrameOnly: true) |
| // Remember to @import WebKit at the top of the class | |
| // Javascript that disables pinch-to-zoom by inserting the HTML viewport meta tag into <head> | |
| NSString *source = @"var style = document.createElement('style'); \ | |
| style.type = 'text/css'; \ | |
| style.innerText = '*:not(input):not(textarea) { -webkit-user-select: none; -webkit-touch-callout: none; }'; \ | |
| var head = document.getElementsByTagName('head')[0];\ | |
| head.appendChild(style);"; | |
| WKUserScript *script = [[WKUserScript alloc] initWithSource:source injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES]; | |
| You can test ATS diagnositcs in Mac OS X El Capitan by running: | |
| nscurl --ats-diagnostics -v https://s3.amazonaws.com | |
| Here is the log: | |
| ================================================================================ | |
| Starting ATS Diagnostics | |
| Configuring ATS Info.plist keys and displaying the result of HTTPS loads to https://s3.amazonaws.com. |