Skip to content

Instantly share code, notes, and snippets.

-(void)exportVideo
{
CGSize renderingSize = CGSizeMake(640, 360); // The desired size of your video
float displayDuration = 2.0f; //The duration of the desired video, in seconds
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *myPathDocs = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"FinalVideo-%d.mov",arc4random() % 1000]];
NSURL *url = [NSURL fileURLWithPath:myPathDocs];
//
// CustomFont.swift
// BLNC
//
// Created by Egor Merkushev on 31.05.2021.
// MIT
// Source: https://stackoverflow.com/a/58971579/602249
import SwiftUI
@SoundBlaster
SoundBlaster / SwiftUI.playground
Last active November 10, 2021 21:45
Empty View as last item in SwiftUI List
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
ZStack {
List {
ForEach(1..<20) { idx in
if idx == 19 {
https://www.osstatus.com
-12884 - Media File not received
code -1008, underlying -12884 - Playlist File not received
-11819 AVErrorMediaServicesWereReset with NSOSStatusErrorDomain Code=-12178, solution: rebuild AVPlayer|Item and asset
HTTP | errorStatusCode | errorDomain | errorComment
204 -12667 CoreMediaErrorDomain HTTP 204: (unhandled)
400 -12666 CoreMediaErrorDomain unrecognized http response 400
@SoundBlaster
SoundBlaster / AppleScript.workflow
Created November 30, 2020 08:05
Apple Books DRM remover
tell application "System Events"
tell application process "Books"
set frontmost to true
end tell
end tell
say "start"
set i to 0
@SoundBlaster
SoundBlaster / gist:05362e2ee026a524f2489483edcb777d
Last active April 22, 2021 07:38
Change Mac Catalyst SwiftUI app UISplitViewController background style to sidebar as in native Mac SwiftUI app
// Apple Forum Question https://developer.apple.com/forums/thread/129211?answerId=620460022#620460022
//
// SceneDelegate.swift
//
// Created by Egor Merkushev on 11.07.2020.
// Copyright © 2020 Egor Merkushev. All rights reserved.
//
import UIKit
import SwiftUI
@SoundBlaster
SoundBlaster / SwitchableProxy
Created March 4, 2020 06:24
SwitchableProxy to enable and disable methods of some T object by one property
/// SwitchableProxy.h content:
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol SwitchableObject
@property (nonatomic, readwrite, assign, getter=isEnabled) BOOL enabled;
+ (BOOL)isSwitchableSelector:(SEL)selector;
@end
@SoundBlaster
SoundBlaster / gist:6b1f2ec958f5f0510a2960d119435772
Last active January 31, 2019 16:14
GradientTextView - simple subclass of UITextView to fill a drawing text with gradient. Just a proof-of-concept. Or you can just use UIColor from pattern image: [UIColor colorWithPatternImage:gradienImageWithSizeEqualToTextViewSize]
static inline UIImage *DrawLayerAsImage(CALayer *layer) {
UIImage *res = nil;
if (layer != nil) {
CGSize size = layer.bounds.size;
UIGraphicsBeginImageContextWithOptions(size, NO, 0);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[layer renderInContext:ctx];
res = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
@SoundBlaster
SoundBlaster / WebViewWithAssetsImage.js
Last active November 8, 2017 21:19
Show an image from the Android assets folder as a content of WebView component (React Native, Android)
class WebViewWithImage extends Component {
render() {
const html = `<!DOCTYPE HTML><html>
<head>
<title>Image from Assets</title>
</head>
<body>
<img src="./image.png" alt="Example">
</body>
</html>`

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream