Skip to content

Instantly share code, notes, and snippets.

View antranapp's full-sized avatar

An Tran antranapp

View GitHub Profile
- (void)setupMapSnapshot
{
CLLocationCoordinate2D coordinate = self.outlet.annotaion.coordinate;
MKMapSnapshotOptions* options = [MKMapSnapshotOptions new];
options.size = self.mapImageView.frame.size;
options.scale = [[UIScreen mainScreen] scale];
options.region = MKCoordinateRegionMakeWithDistance(coordinate, 2000.f, 2000.f);
MKMapSnapshotter* snapshotter = [[MKMapSnapshotter alloc] initWithOptions:options];
@antranapp
antranapp / gist:89b1ebef5a0a984140a3
Created May 3, 2015 15:59
[iOS] Change title and tint color for navigation controller
self.navigationController?.navigationBar.barTintColor = UIColor.redColor()
self.navigationController?.navigationBar.translucent = false
self.navigationController?.navigationBar.tintColor = UIColor.whiteColor()
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
@antranapp
antranapp / No Inset for TableViewCells
Created May 14, 2015 12:46
Remove Inset of TableViewCells
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.layoutMargins = UIEdgeInsetsZero
cell.separatorInset = UIEdgeInsetsZero
cell.preservesSuperviewLayoutMargins = false
}
@antranapp
antranapp / CMSampleBufferRef_to_vImage.m
Created November 25, 2022 10:52 — forked from podkovyrin/CMSampleBufferRef_to_vImage.m
CMSampleBufferRef to vImage and resize
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
CVPixelBufferLockBaseAddress(imageBuffer,0);
size_t height = CVPixelBufferGetHeight(imageBuffer);
size_t width = CVPixelBufferGetWidth(imageBuffer);
size_t bytesPerRow = CVPixelBufferGetBytesPerRow(imageBuffer);
void *sourceData = CVPixelBufferGetBaseAddress(imageBuffer);
// Set a bunch of variables we need. The "radius" for the blur kernel needs to be positive and odd. The permute map maps the BGRA channels of the buffer to the ARGB that vImage needs.
import SwiftUI
struct ContentView: View {
@State var t: Float = 0.0
@State var timer: Timer?
var body: some View {
ZStack {
MeshGradient(