This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation MySharedThing | |
+ (id)sharedInstance | |
{ | |
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{ | |
return [[self alloc] init]; | |
}); | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use feature ':5.10'; | |
use Marpa::XS; | |
use Data::Dumper; | |
# | |
# a simple CSS snippet for testing | |
# | |
my $text = q{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface SafeSet : NSObject { | |
NSMutableSet *set; | |
dispatch_queue_t queue; | |
} | |
@end | |
@implementation SafeSet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type SetTest struct { | |
val string | |
result chan bool | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BASE_COMMIT=$(echo {\"diff_id\": ${DIFF_ID}} | arc call-conduit differential.getdiff | awk -v RS=',' -v FS=':' '$1~/\"sourceControlBaseRevision\"/ {print $2}' | tr -d \") | |
# Update repo (can be taken care of by jenkins too) | |
git fetch --all | |
git remote prune origin | |
# We only want to test the diff so reset to base | |
git reset --hard ${BASE_COMMIT} | |
git clean -fdx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSArray *albums = @[[Album albumWithName:@"Random Access Memories" price:9.99f], | |
[Album albumWithName:@"Clarity" price:6.99f], | |
[Album albumWithName:@"Weekend in America" price:7.99f], | |
[Album albumWithName:@"Weekend in America" price:7.90f], | |
[Album albumWithName:@"Bangarang EP" price:2.99f]]; | |
// Reversing an Array | |
__unused NSArray *reversed = albums.reverseObjectEnumerator.allObjects; | |
// PREDICATES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 2021-12-09: | |
# This script is no longer supported! | |
# Apple broke all direct downloads without logging with an Apple ID first. | |
# The number of hoops that a script would need to jump through to login, | |
# store cookies, and download is prohibitive. | |
# Now we all must manually download and mirror the files for this to work at all :'-( | |
OSX_VERS=$(sw_vers -productVersion | awk -F "." '{print $2}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lldb | |
import re | |
import shlex | |
# This script allows Xcode to selectively ignore Obj-C exceptions | |
# based on any selector on the NSException instance | |
def getRegister(target): | |
if target.triple.startswith('x86_64'): | |
return "rdi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Automate loading of F-Script Anywhere into any app. | |
By Daniel Jalkut - @danielpunkass - http://indiestack.com/ | |
To set up: | |
0. Make sure you have FScript.framework installed in /Library/Frameworks (http://www.fscript.org) | |
1. Copy this script to ~/.lldb/fsa.py | |
2. Add the following to your ~/.lldbinit file: |
OlderNewer