Skip to content

Instantly share code, notes, and snippets.

@nguyen-tam
nguyen-tam / postmark_opened_email.php
Created August 26, 2023 09:15
Postmarkapp open tracking example in PHP
<?php
// Define Postmark API endpoint, token
$baseEndpoint = "https://api.postmarkapp.com/messages/outbound/opens";
$serverToken = "YOUR_TOKEN"; // Replace with your actual server token
$headers = [
"Accept: application/json",
"X-Postmark-Server-Token: $serverToken"
];
@nguyen-tam
nguyen-tam / VideoFileRotate.m
Last active April 30, 2020 11:02
Objective C - Rotate a video file with AVMutableVideoCompositionLayerInstruction
-(void)changeOrientation:(NSURL *) videoURL isClockWise:(BOOL)isClockWise fileName:(NSString *)fileName{
AVURLAsset* videoAsset = [[AVURLAsset alloc]initWithURL:videoURL options:nil];
AVMutableComposition* mixComposition = [[AVMutableComposition alloc] init];
AVMutableCompositionTrack *videoCompositionTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
[videoCompositionTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:[[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] atTime:kCMTimeZero error:nil];
AVMutableVideoCompositionInstruction *videoCompositionInstruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction];
videoCompositionInstruction.timeRange = CMTimeRangeMake(kCMTimeZero, videoAsset.duration);
AVMutableVideoCompositionLayerInstruction *videoCompositionLayerInstruction = [AVMutableVideoCompositionLayerInstruction videoComposition