Skip to content

Instantly share code, notes, and snippets.

View lostincode's full-sized avatar
🥨

Bill Richards lostincode

🥨
View GitHub Profile
@ericallam
ericallam / AppDelegate.m
Created May 22, 2014 14:49
Interactive Animated Transition Example
//
// AppDelegate.m
// AnimationExamplesiPhone
//
// Created by Eric Allam on 10/05/2014.
#import "AppDelegate.h"
#pragma mark - UIColor Additions
@clifgriffin
clifgriffin / autofit_text_to_image.php
Last active May 4, 2022 18:04
Auto fit text to image using PHP / Imagick
<?php
/**
* Auto Fit Text To Image
*
* Write text to image using a target width, height, and starting font size.
*
* @author Clif Griffin
* @url http://cgd.io/2014/auto-fit-text-to-an-image-with-php-and-wordpress
*
@BenziAhamed
BenziAhamed / CGCreatePattern.swift
Last active May 24, 2022 22:24
Demonstration of using CGCreatePattern in Swift
//: Playground - noun: a place where people can play
//: Copy this to one!
import UIKit
// With helpful insights from
// https://forums.developer.apple.com/message/15725#15725 via http://oleb.net/blog/2015/06/c-callbacks-in-swift/
// This is essential the standalone basic definition of a pattern
// that CGCreatePattern requires
@Pretz
Pretz / swift-json.md
Last active May 9, 2022 10:58
A comparison of different JSON Object Mapping Libraries for Swift

Swift JSON Object Mappers

struct User {
  let id: Int
  let name: String
  let email: String?
  let role: Role
@nenad-mitic-bg
nenad-mitic-bg / merge-two-gifs.php
Created January 12, 2016 08:09
Merge two animated GIFs with PHP (ImageMagick)
<?php
/*
* This can be used to merge two animated gifs into one. Both GIFs should
* have the same size and frame rates. ImageMagick is needed for this to work
*
* Author: Nenad Mitic [email protected]
*
*/
@michaelochs
michaelochs / NSFormattingContextDynamic.m
Created December 13, 2016 15:37
`NSFormattingContextDynamic` makes a formatter return string proxies that change based on where you but them inside a format string.
NSDate *date = [NSDate new];
NSDateFormatter *dateFormatter = [NSDateFormatter new];
dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"nl_NL"];
dateFormatter.dateStyle = NSDateFormatterFullStyle;
dateFormatter.formattingContext = NSFormattingContextDynamic; // this is the important setting
NSString *dateString = [dateFormatter stringFromDate:date];
NSString *s1 = [NSString stringWithFormat:@"Foo %@", dateString]; // "Foo dinsdag 13 december 2016"

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@powhu
powhu / GIF2MP4.swift
Last active December 10, 2024 20:44
Swift 5.0 GIF to MP4
//
// GIF2MP4.swift
//
// Created by PowHu Yang on 2020/4/24.
// Copyright © 2020 PowHu Yang. All rights reserved.
//
/* How to use
let data = try! Data(contentsOf: Bundle.main.url(forResource: "gif", withExtension: "gif")!)
let tempUrl = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("temp.mp4")
/*
Erica Sadun, http://ericasadun.com
Cross Platform Defines
Apple Platforms Only
Will update to #if canImport() when available
*/
@samjarman
samjarman / force_kill.m
Created July 31, 2017 03:13
Force kill iOS app programmatically
@interface UIApplication(InternalAppAdditions)
- (void)terminateWithSuccess;
@end
#warning: This is private API. Do not try to submit this line to TestFlight or the App Store.
[[UIApplication sharedApplication] terminateWithSuccess];