thanks 4 putting source for a noob to learn a little
-
DocSets-for-iOS and paid 4 it too https://github.com/omz/DocSets-for-iOS/
-
Real Time Congress
require 'aes' | |
# Obvious part | |
plain = "Very important message" | |
full_valid_password = "password" | |
encrypted = AES.encrypt(plain, full_valid_password) | |
decrypted = AES.decrypt(encrypted, full_valid_password) | |
plain == decrypted #=> true, obviously | |
# Now the sad part |
- (UIInterfaceOrientation)relativeInterfaceOrientationFromRotationAngle:(CGFloat)angle { | |
NSArray * conversionMatrix = @[ @(UIInterfaceOrientationPortrait), | |
@(UIInterfaceOrientationLandscapeRight), | |
@(UIInterfaceOrientationPortraitUpsideDown), | |
@(UIInterfaceOrientationMaskLandscapeLeft)]; | |
NSInteger oldIndex = [conversionMatrix indexOfObject:@(self.interfaceOrientation)]; | |
if (oldIndex == NSNotFound) | |
return UIInterfaceOrientationUnknown; | |
NSInteger newIndex = (oldIndex - (NSInteger)roundf(angle / M_PI_2)) % 4; |
thanks 4 putting source for a noob to learn a little
DocSets-for-iOS and paid 4 it too https://github.com/omz/DocSets-for-iOS/
Real Time Congress
import CoreData | |
protocol Fetchable | |
{ | |
typealias FetchableType: NSManagedObject | |
static func entityName() -> String | |
static func objectsInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> [FetchableType] | |
static func singleObjectInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> FetchableType? | |
static func objectCountInContext(context: NSManagedObjectContext, predicate: NSPredicate?) -> Int |
post_install do | installer | | |
print "Updating #{installer.sandbox.target_support_files_root}/Pods/Pods-environment.h\n" | |
open("#{installer.sandbox.target_support_files_root}/Pods/Pods-environment.h","a") do |file| | |
file.puts <<EOF | |
// Disable logs | |
#ifndef DEBUG | |
#define NSLog(...) | |
#endif | |
EOF | |
end |
import Cocoa | |
// Support Foundation calls on String | |
public extension String { public var ns: NSString {return self as NSString} } | |
/// Custom Labeled Playground-Based Drag-and-Drop window | |
public class DropView: NSTextField { | |
// Default action handler | |
public var handler: ([String]) -> Void = { paths in Swift.print(paths) } |
import SwiftUI | |
import PlaygroundSupport | |
struct showArt: View { | |
@Binding var isPlaying: Bool | |
var body: some View { | |
VStack { | |
VStack { | |
RoundedRectangle(cornerRadius: 16) | |
.shadow(color: Color(UIColor.black.withAlphaComponent( isPlaying ? 0.3 : 0.1)), radius: 20, x: 0, y: 10) |
- (UIInterfaceOrientation)orientationByTransforming:(CGAffineTransform)transform fromOrientation:(UIInterfaceOrientation)c | |
{ | |
CGFloat angle = atan2f(transform.b, transform.a); | |
NSInteger multiplier = (NSInteger)roundf(angle / M_PI_2); | |
UIInterfaceOrientation orientation = self.interfaceOrientation; | |
if (multiplier < 0) { | |
// clockwise rotation | |
while (multiplier++ < 0) { | |
switch (orientation) { |
/* -fno-objc-arc | |
CFTypeRef _unsafeCreatePartiallyInitialized(Class c) { | |
Method method = class_getInstanceMethod([NSObject class], @selector(init)); | |
IMP imp = method_getImplementation(method); | |
return ((id (*)(id, SEL))imp)([c alloc], @selector(init)); | |
} | |
void _unsafeDestructPartiallyInitialized(CFTypeRef x) { | |
Method method = class_getInstanceMethod([NSObject class], @selector(dealloc)); | |
IMP imp = method_getImplementation(method); |