Skip to content

Instantly share code, notes, and snippets.

@midaw
midaw / VideoUltilities.swift
Created February 4, 2022 13:23
Trim, crop, remove audio from video.
//
// VideoUltilities.swift
//
// Created by Le Ngoc Giang on 4/13/16.
// Copyright © 2016 gianglengoc. All rights reserved.
//
import Foundation
import AVFoundation
import AssetsLibrary
@midaw
midaw / VideoHelper.swift
Created February 4, 2022 13:22
Download video and trim video from range time
//
// VideoHelper.swift
//
// Created by Giang Le Ngoc on 2/5/20.
// Copyright © 2020 Giang Le Ngoc. All rights reserved.
//
import Foundation
import AVFoundation
import UIKit
@midaw
midaw / AutolayoutHelper.swift
Created August 29, 2020 18:09 — forked from pchelnikov/AutolayoutHelper.swift
Swift Autolayout Helper
extension UIView {
// MARK: - Safe anchors
/// Contains view's top anchor depending to iOS version.
var safeTopAnchor: NSLayoutYAxisAnchor {
if #available(iOS 11.0, *) {
return self.safeAreaLayoutGuide.topAnchor
} else {
return self.topAnchor
test
wewe
@midaw
midaw / c-mask.mm
Created March 15, 2018 08:17 — forked from lamprosg/c-mask.mm
(iOS) Image masking Objective-C / Swift
//http://www.innofied.com/implementing-image-masking-in-ios/
- (UIImage*) maskImage:(UIImage *) image withMask:(UIImage *) mask
{
CGImageRef imageReference = image.CGImage;
CGImageRef maskReference = mask.CGImage;
CGImageRef imageMask = CGImageMaskCreate(CGImageGetWidth(maskReference),
CGImageGetHeight(maskReference),
CGImageGetBitsPerComponent(maskReference),
@midaw
midaw / PostBuildProcess.cs
Created October 4, 2017 18:50 — forked from suakig/PostBuildProcess.cs
PostBuildProcess.cs
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using System.IO;
using System.Collections.Generic;
public class PostBuildProcess : MonoBehaviour
{
internal static void CopyAndReplaceDirectory(string srcPath, string dstPath)
@midaw
midaw / ItemButton.cs
Created October 4, 2017 18:49 — forked from suakig/ItemButton.cs
ItemButton.cs
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ItemButton : MonoBehaviour
{
public int price = 1000;
private Button itemButton;
void Awake ()