Skip to content

Instantly share code, notes, and snippets.

View ChrisBuchholz's full-sized avatar

Christoffer Buchholz ChrisBuchholz

View GitHub Profile
@ChrisBuchholz
ChrisBuchholz / DetailViewController.swift
Last active August 29, 2015 14:14
interactive keyboard dismiss bug
import UIKit
class DetailViewController: UIViewController {
@IBOutlet weak var scrollView: UIScrollView!
var textView: UITextView?
var detailItem: AnyObject?
override func viewDidLoad() {
NSMutableArray *banBookey = [NSMutableArray array];
[string enumerateSubstringsInRange:NSMakeRange(0, string.length) options:NSStringEnumerationByLines usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
for (id key in patternsByLine) {
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:patternsByLine[key] options:NSRegularExpressionCaseInsensitive error:&error];
[regex enumerateMatchesInString:substring options:0 range:NSMakeRange(0, substring.length) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop) {
unsigned long startBan = substringRange.location + match.range.location;
unsigned long endBan = startBan + match.range.length;
BOOL paint = YES;
@ChrisBuchholz
ChrisBuchholz / Log
Last active August 29, 2015 14:09
UITextView not getting removed
textview: Optional(<UITextView: 0x7fa37182ca00; frame = (0 0; 375 667); text = 'gdfgdgf gdfg'; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7fa3714b8d80>; layer = <CALayer: 0x7fa3714c2060>; contentOffset: {0, -8}; contentSize: {375, 667}>)
text: Optional("gdfgdgf gdfg")
superview: Optional(<UIScrollView: 0x7fa371657750; frame = (0 0; 375 667); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fa371546dc0>; layer = <CALayer: 0x7fa3715ebd70>; contentOffset: {0, -64}; contentSize: {375, 667}>)
calling removeFromFromSuperview and setting to nil
called removeFromSuperview and set to nil
#!/usr/bin/env xcrun swift
// ------------------- P L A Y G R O U N D ------------------------------------
import SceneKit
import QuartzCore
let PlaygroundSize: CGSize = CGSize(width: 300, height: 300)
AEProfiling.framework
AERegistration.framework
AudioMixEngine.framework
Libmacgpg.framework
NyxAudioAnalysis.framework
PluginManager.framework
iTunesLibrary.framework
@ChrisBuchholz
ChrisBuchholz / new-xcode-ios-playground.sh
Created October 13, 2014 17:45
New XCode Playground
TIMESTAMP=`date +%s`
PLAYGROUNDDIR=~/Playgrounds/
NEW=$TIMESTAMP.playground
PLAYGROUND=$PLAYGROUNDDIR$NEW
mkdir -p $PLAYGROUND
cat > $PLAYGROUND/section-1.swift <<EOF
// Playground - noun: a place where people can play

Keybase proof

I hereby claim:

  • I am chrisbuchholz on github.
  • I am chrisbuchholz (https://keybase.io/chrisbuchholz) on keybase.
  • I have a public key whose fingerprint is 659D 0A76 0780 34D3 83EB 03E1 BEBF 7E8D 7EA0 1D78

To claim this, I am signing this object:

self.incomingScene.size = self.outgoingScene.view.frame.size;
[self.incomingScene.view layoutIfNeeded];
UIImage *screenshot = [self getScreenshotOfScene:self.incomingScene];
NSLog(@"width: %f", screenshot.size.width);
- (UIImage *)getScreenshotOfScene:(SKScene *)scene {
[scene.view layoutIfNeeded];
scene.size = CGSizeMake(200.0, 200.0);
UIGraphicsBeginImageContextWithOptions(scene.view.bounds.size, NO, 1);
[scene.view drawViewHierarchyInRect:scene.view.frame afterScreenUpdates:YES];
UIImage *ss = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImage *image = [UIImage imageWithCGImage:[ss CGImage]];
return image;
javascript:(function() {
var bookmarklet = {
init: function() {
this.parse();
},
parse: function() {
page = "";
$(".PlaylistPage:visible")
.children(".Collection")
.find(".Track")