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
void renderSphere(float cx, float cy, float cz, float r, int p) | |
{ | |
float theta1 = 0.0, theta2 = 0.0, theta3 = 0.0; | |
float ex = 0.0f, ey = 0.0f, ez = 0.0f; | |
float px = 0.0f, py = 0.0f, pz = 0.0f; | |
GLfloat vertices[p*6+6], normals[p*6+6], texCoords[p*4+4]; | |
if( r < 0 ) | |
r = -r; | |
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
- (void)showCard:(id)sender | |
{ | |
UIGraphicsBeginImageContext(self.view.window.frame.size); | |
[self.view.window.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
UIViewControllerSubclass *card = [[UIViewControllerSubclass alloc] init]; | |
card.background = screenshot; | |
[self presentModalViewController:card animated:NO]; |
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
/* | |
* This code doesn't work, I'm hoping for some help. | |
* | |
* I'm trying to use reflection to dig into Android's @hide classes that store screenshots | |
* of the currently running apps. | |
* | |
* The code compiles and runs perfectly, but mThumbnailReceiver is never called back with | |
* the bitmaps. | |
* | |
* I've never done Android development before (I'm an iOS dev) but I'd love to get this |
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
// When you init your view | |
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(scrollViewDidScroll:) name:NSViewBoundsDidChangeNotification object:scrollView.contentView]; | |
// The methods | |
- (void)scrollViewDidBeginScrolling | |
{ | |
// Do stuff | |
} |
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
- (void)loadOrResizeOrSometing { | |
/* | |
* After creating the text view or resizing the font, set the quoteWidth and contentInset. | |
*/ | |
WPTextContainer *textContainer = (WPTextContainer*)paragraphView.textContainer; | |
textContainer.spaceWidth = [self widthForCharacter:@" "]; | |
textContainer.charWidths = @{ | |
@(8220) : @([self widthForCharacter:@"“"]), | |
@(8216) : @([self widthForCharacter:@"‘"]), | |
@('"') : @([self widthForCharacter:@"\""]), |
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
// | |
// WPTextAttachment.h | |
// ReadArticle | |
// | |
// Created by Moore, Stuart on 12/27/13. | |
// Copyright (c) 2013 The Washington Post. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
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
- (CGFloat)heightThatFits { | |
if(!self.text || [self.text isEqualToString:@""]) | |
return 0; | |
if([self respondsToSelector:@selector(attributedText)]) { | |
CGSize maxSize = (CGSize){ self.frame.size.width, MAXFLOAT }; | |
CGRect frame = [self.attributedText boundingRectWithSize:maxSize | |
options:(NSStringDrawingUsesLineFragmentOrigin| | |
NSStringDrawingUsesFontLeading) | |
context:nil]; |
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
Moved to https://github.com/stuartjmoore/Keyboard-Resources to allow for images and more files. |
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
//: Playground - noun: a place where people can play | |
import XCPlayground | |
import UIKit | |
// MARK: - Paragraph Styles | |
let headlineParagraphStyle = NSMutableParagraphStyle() | |
headlineParagraphStyle.lineHeightMultiple = 0.8 |
OlderNewer