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 'dart:ui'; | |
import 'package:flutter/material.dart'; | |
import 'dart:math' as math; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { |
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
// | |
// UIResponder.swift | |
// | |
// Created by Groom on 23/03/2015. | |
// Copyright (c) 2015 Stephen Groom. All rights reserved. | |
// | |
import UIKit | |
extension UIResponder { |
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
// | |
// Anchor.swift | |
// AnchorTest | |
// | |
// Created by Jonathan Wight on 7/10/15. | |
// Copyright © 2015 schwa.io. All rights reserved. | |
// | |
#if os(OSX) | |
import AppKit |
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
# Pure Python ChaCha20 | |
# Based on Numpy implementation: https://gist.github.com/chiiph/6855750 | |
# Based on http://cr.yp.to/chacha.html | |
# | |
# I wanted an implementation of ChaCha in clean, understandable Python | |
# as a way to get a handle on the algorithm for porting to another language. | |
# There are plenty of bindings but few pure implementations, because | |
# Pure Python is too slow for normal practical use in Cryptography. | |
# | |
# The preceding implementation used NumPy, which avoided a lot of the |
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
// CGContextABCD(context!, ...) becomes context?.ABCD(...) | |
import Cocoa | |
extension CGContext { | |
func saveGState() { CGContextSaveGState(self) } | |
func restoreGState() { CGContextRestoreGState(self) } | |
func scaleCTM( sx: CGFloat, sy: CGFloat) { CGContextScaleCTM(self, sx, sy) } | |
func translateCTM( tx: CGFloat, ty: CGFloat) { CGContextTranslateCTM(self, tx, ty) } | |
func rotateCTM( angle: CGFloat) { CGContextRotateCTM(self, angle) } |
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 | |
extension NSString { | |
/** | |
http://stackoverflow.com/questions/800123/what-are-best-practices-for-validating-email-addresses-in-objective-c-for-ios-2 | |
RFC 2822 http://tools.ietf.org/html/rfc2822 | |
*/ | |
func isEmail() -> Bool { | |
let sRegex = "(?:[a-z0-9!#$%\\&'*+/=?\\^_`{|}~-]+(?:\\.[a-z0-9!#$%\\&'*+/=?\\^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])" |
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
// | |
// RBResizer.swift | |
// Locker | |
// | |
// Created by Hampton Catlin on 6/20/14. | |
// Copyright (c) 2014 rarebit. All rights reserved. | |
// | |
import UIKit |