This file contains hidden or 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 SwiftUI | |
extension CGRect { | |
fileprivate func point(anchor: UnitPoint) -> CGPoint { | |
var point = self.origin | |
point.x += self.size.width * anchor.x | |
#if os(macOS) | |
point.y += self.size.height * (1 - anchor.y) | |
#else | |
point.y += self.size.height * anchor.y |
This file contains hidden or 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
// | |
// SnapCarousel.swift | |
// prototype5 | |
// | |
// Created by xtabbas on 5/7/20. | |
// Copyright © 2020 xtadevs. All rights reserved. | |
// | |
import SwiftUI |
This file contains hidden or 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
extension UITableView { | |
func animateSection<Element: Equatable>(section: Int, from:[Element], to: [Element], rowAnimation: UITableViewRowAnimation = .Top) { | |
assert(from.containsUniqueElements() && to.containsUniqueElements(), "\(#function) can only be used if all elements in the collection are unique.") | |
func path(index: Int) -> NSIndexPath { | |
return NSIndexPath(forRow: index, inSection: section) | |
} | |
// Find indexes in the old array that should be deleted |
This file contains hidden or 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
// The MIT License (MIT) | |
// | |
// Copyright (c) 2016 Jansel Valentin | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
This file contains hidden or 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
# Require imagemagick | |
# require potrace | |
# sudo apt-get install imagemagick potrace | |
import os | |
import argparse | |
import glob | |
parser = argparse.ArgumentParser() | |
parser.add_argument( | |
"files", type=str, help="png2svg", nargs="*" |
This file contains hidden or 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
// Thanks to http://www.labs.saachitech.com/2012/10/23/pdf-generation-using-uiprintpagerenderer | |
// Note: including images in the HTML won't work, see here: | |
// https://github.com/nyg/HTMLWithImagesToPDF | |
import UIKit | |
// 1. Create a print formatter | |
let html = "<b>Hello <i>World!</i></b>" | |
let fmt = UIMarkupTextPrintFormatter(markupText: html) |
This file contains hidden or 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
@interface MKMapView (Extensions) | |
-(double)as_zoomLevel; | |
-(void)as_setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(NSUInteger)zoomLevel animated:(BOOL)animated; | |
@end | |
static double mercadorRadius = 85445659.44705395; | |
static double mercadorOffset = 268435456; |
This file contains hidden or 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
// | |
// NSString+MBDialogString.m | |
// TileParser | |
// | |
// Created by Moshe Berman on 9/23/12. | |
// | |
// | |
#import "NSString+MBDialogString.h" |
This file contains hidden or 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)printRecursivelyUpTo:(NSUInteger)max { | |
__block dispatch_block_t block; | |
__block NSUInteger iterator = 0; | |
dispatch_block_t b = ^{ | |
if(iterator == max) return; | |
NSLog(@"%u", iterator); | |
++iterator; | |
block(); | |
}; |
This file contains hidden or 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
#!/bin/bash | |
if [ "$1" == "" ]; then | |
echo Usage: $0 pngfile | |
exit 0; | |
fi | |
FILE=`basename $1 .png` | |
if [ ! -e $FILE.png ]; then |
NewerOlder