I hereby claim:
- I am torsten on github.
- I am torsten (https://keybase.io/torsten) on keybase.
- I have a public key whose fingerprint is E054 EF92 AC0F B3E7 9BA3 5F8A 6B9B FA0C CE67 02B9
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
-- Related blog post to this Gist: | |
-- https://torsten.io/stdout/expanding-json-arrays-to-rows | |
-- Run these commands on a interactive RedShift session: | |
CREATE TEMP TABLE clusters AS ( | |
SELECT 1 AS id, '[1, 2]' AS node_sizes UNION ALL | |
SELECT 2 AS id, '[5, 1, 3]' AS node_sizes UNION ALL | |
SELECT 3 AS id, '[2]' AS node_sizes | |
); |
Combine http://aws.amazon.com/ec2/pricing/ and http://aws.amazon.com/ec2/instance-types/#selecting-instance-types into one f*cking table.
Type | Arch | vCPU | ECU | Mem | Storage | EBS-optimized | Network | Price ------|------|------|------|-----|-----|---------|---------------|---------------------|-------- General ||||||||| t1.micro | 32/64 | 1 | Variable | 0.615 | EBS only | - | Very Low | $0.020 m1.small | 32/64 | 1 | 1 | 1.7 | 1 x 160 | - | Low | $0.065 m1.medium | 32/64 | 1 | 2 | 3.75 | 1 x 410 | - | Moderate | $0.130 m1.large | 64 | 2 | 4 | 7.5 | 2 x 420 | Yes | Moderate | $0.260
// clang -framework Foundation check-non-latin.m && ./a.out | |
#import <Foundation/Foundation.h> | |
int main (int argc, char const *argv[]) | |
{ | |
@autoreleasepool | |
{ | |
NSDictionary *langToText = @{@"arabic": [NSString stringWithUTF8String:"العربي"], | |
@"japanese": [NSString stringWithUTF8String:"日本"], |
NSArray *entities = self.managedObjectContext.persistentStoreCoordinator.managedObjectModel.entities; | |
for (NSEntityDescription *desc in entities) | |
{ | |
NSFetchRequest *allObjectsRequest = [NSFetchRequest fetchRequestWithEntityName:desc.name]; | |
NSError *fetchError; | |
NSArray *allObjects = [self.managedObjectContext executeFetchRequest:allObjectsRequest error:&fetchError]; | |
if (allObjects) | |
{ |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>beforeRunningCommand</key> | |
<string>nop</string> | |
<key>command</key> | |
<string>open "dash://${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}"</string> | |
<key>input</key> | |
<string>none</string> |
#!/bin/sh | |
# Pre-commit hook for git which removes trailing whitespace, converts tabs to spaces, and enforces a max line length. | |
if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then | |
against=HEAD | |
else | |
# Initial commit: diff against an empty tree object | |
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
fi |
// Illustrates that not all causes of retain cycles are detected by clang. Compile with: | |
// clang -fobjc-arc -Wall -framework Foundation test-cycle-warnings.m && ./a.out | |
#import <Foundation/Foundation.h> | |
@interface Foo : NSObject | |
typedef void (^Block)(); | |
@property (readwrite, copy) Block asd; |
// Run with: | |
// clang -fobjc-arc -Wall -framework Foundation blockself.m && ./a.out | |
// Further reading: | |
// http://www.mikeash.com/pyblog/friday-qa-2009-08-14-practical-blocks.html | |
// http://clang.llvm.org/docs/AutomaticReferenceCounting.html#misc.blocks | |
// http://developer.apple.com/library/mac/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html | |
#import <Foundation/Foundation.h> |
// OCUnit/SenTestCase's vanilla testInvocations method does not produce a unique list of methods | |
// when you inherit from a common test base class. Currently it will call the same test methods | |
// multiple times, depending on the number of base classes. | |
// | |
// To prevent these duplicate test method calls, override testInvocations like this. | |
// | |
// Written in 2012 by Torsten Becker <[email protected]> | |
@interface BetterTestCase : SenTestCase |