Skip to content

Instantly share code, notes, and snippets.

View iziz's full-sized avatar
💭
I may be slow to respond.

iziz iziz

💭
I may be slow to respond.
View GitHub Profile
@Nyx0uf
Nyx0uf / NYXAVCEncoder.swift
Created February 3, 2016 10:35
Hardware accelerated GIF to MP4 converter in Swift using VideoToolbox
import VideoToolbox
import AVFoundation
private var __canHWAVC: Bool = false
private var __tokenHWAVC: dispatch_once_t = 0
public protocol NYXAVCEncoderDelegate : class
{
func didEncodeFrame(frame: CMSampleBuffer)
func didFailToEncodeFrame()
@Nyx0uf
Nyx0uf / gist:217d97f81f4889f4445a
Last active November 15, 2020 22:31
UIImage scale using vImage
-(UIImage*)mmg_imageScaledToFitSize:(CGSize)fitSize
{
// Create a vImage_Buffer from the CGImage
CGImageRef sourceRef = self.CGImage;
vImage_Buffer srcBuffer;
vImage_CGImageFormat format = {
.bitsPerComponent = 8,
.bitsPerPixel = 32,
.colorSpace = NULL,
.bitmapInfo = (CGBitmapInfo)kCGImageAlphaFirst,
@craigeley
craigeley / sifttter.rb
Last active July 23, 2018 16:37
This script looks for text files in a specific folder that include completed tasks ('@done') and timestamps, and then collects them into a daily log for the Day One journaling application. It works especially well when it's connected to IFTTT. See more details at http://craigeley.com/tagged/sifttter
#!/usr/bin/ruby
# SIFTTTER 1.5: An IFTTT-to-Day One Logger by Craig Eley 2014 <http://craigeley.com>
# Based on tp-dailylog.rb by Brett Terpstra 2012 <http://brettterpstra.com>
# Multiple Date Function by Paul Hayes 2014 <http://paulrhayes.com>
#
# Notes:
# * Uses `mdfind` to locate a specific folder of IFTTT-generated text files changed in the last day
# * The location of your folder should be hardcoded in line 67, and the location of your Day One in line 66
# * Scans leading timestamps in each line matching the selected dates
# * Does not alter text files in any way
@hyukhur
hyukhur / arguments passed on launch with '-option' for Push Notification in Simulator
Created November 15, 2013 06:45
아이폰 개발 중 시뮬레이터에 푸시 전달받아 앱 런칭되는 것을 흉내내야하는 경우가 발생하는데 이 때 사용하면 된다. 스키마 설정에 들어가보면 인자값 설정하는 부분이 있고 -option 이라는 값으로 NSPropertyList 값( apn을 통해 앱으로 전달 받는 포맷)을 그대로 전달해주면 된다.
- (BOOL)application:(UIApplication *)aApplication didFinishLaunchingWithOptions:(NSDictionary *)aLaunchOptions
{
/* for Push Notification in Simulator */
#if TARGET_IPHONE_SIMULATOR
NSProcessInfo *sProcessInfo = [NSProcessInfo processInfo];
NSArray *sArguments = [sProcessInfo arguments];
NSUInteger sIndex = [sArguments indexOfObject:@"-option"];
NSString *sPropertyFomatString = [sArguments objectAtIndexOrNil:sIndex+1];
/* format으로 NULL을 전달하면 앱크래시 */
NSPropertyListFormat sPlistFormat;
@ryanmaxwell
ryanmaxwell / ryan-objc.cfg
Last active June 26, 2019 16:41
Objective-C Uncrustify Config
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.2 (140)
#
# Alignment
# ---------
## Alignment

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";