Skip to content

Instantly share code, notes, and snippets.

@raid5
raid5 / buddybuild_carthage_command.sh
Created December 20, 2017 17:21
Custom BuddyBuild Carthage script to strip out unneeded schemes.
#!/bin/bash
# Save current directory to var
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Fetch dependencies but do not build
carthage update --no-build
# Remove AWSAuthSDK project as this is not needed
rm -r Carthage/Checkouts/aws-sdk-ios/AWSAuthSDK/
//:
//: UIView Animation Syntax Sugar
//:
//: Created by Andyy Hope on 18/08/2016.
//: Twitter: @andyyhope
//: Medium: Andyy Hope, https://medium.com/@AndyyHope
import UIKit
extension UIView {
@isthisjoe
isthisjoe / MovieWriter.swift
Last active July 8, 2020 07:28
Swift 3 | macOs | Write NSImage(s) to a movie file. Modified from http://stackoverflow.com/a/36297656/1275125
import AppKit
import AVFoundation
class MovieWriter: NSObject {
func writeImagesAsMovie(_ allImages: [NSImage], videoPath: String, videoSize: CGSize, videoFPS: Int32) {
// Create AVAssetWriter to write video
guard let assetWriter = createAssetWriter(videoPath, size: videoSize) else {
print("Error converting images to video: AVAssetWriter not created")
return
}
@dakeshi
dakeshi / Clean web data in WKWebView
Created June 10, 2016 06:17
Use an default WKWebView save all caches, cookies data in the app. So it make very critical issue such as infinite increase app size.
/// In AppDelegate.swift
/// Execute remove webdata method when the app receives the memory warning.
///
/// We can not avoid the infinitely get increased the app size issue
/// when users keep the web searching using the WKWebView.
/// So, you would get iOS full storage message.
///
/// Set WKWebsiteDataStore.nonPersistentDataStore in the configuration
/// can make lightweight WKWebView. But it can not apply every web site.
/// Imagine the web sites used the localStorage, IndexedDB features.
@ykob
ykob / mosaic.fs
Last active July 18, 2018 00:45
fragment shader of mosaic filter
uniform vec2 resolution;
uniform sampler2D texture;
varying vec2 vUv;
const float mosaic = 12.0;
void main() {
vec4 color = vec4(0.0);
vec2 offset = vec2(mod(gl_FragCoord.x, mosaic), mod(gl_FragCoord.y, mosaic));
@asus4
asus4 / lut_maker.py
Last active February 1, 2026 13:59
Make LUT Texture
#!/usr/bin/env python
# coding: UTF-8
import cv2
import numpy as np
def make_lut256x16(exportPath):
''' 256 x 16 LUT '''
samples = 16
@chriseidhof
chriseidhof / tableviews.swift
Last active October 15, 2023 20:56
trySwift
import UIKit
// If you enjoyed this talk (video link will be up soon), then you might also enjoy our book Advanced Swift: http://www.objc.io/books/advanced-swift
struct Person {
let name: String
let city: String
}
let people = [
@eyecatchup
eyecatchup / git-commit-log-stats.md
Last active January 17, 2026 04:27
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.




@abeldomingues
abeldomingues / FileConverter.swift
Last active May 7, 2017 15:57
A Swift adaptation of Chris Adamson's Objective-C code for exporting iPod Library audio tracks (obtained as AVAssets using an MPMediaPickerController) to LPCM. See http://www.subfurther.com/blog/2010/12/13/from-ipod-library-to-pcm-samples-in-far-fewer-steps-than-were-previously-necessary/ for Chris' original post.
import UIKit
import AVFoundation
protocol FileConverterDelegate {
func fileConversionCompleted()
}
class FileConverter : NSObject {
var delegate : FileConverterDelegate?
@acj
acj / ATTENTION.md
Last active May 5, 2023 12:23
Build a movie from jpeg images in Swift using AVFoundation

This code has moved

Please refer to the TimeLapseBuilder-Swift repository on GitHub from now on.

I will leave the original code here as a reference, but new comments may be removed. Please open an issue on GitHub if you have questions or would like to contribute.

Thanks!