Skip to content

Instantly share code, notes, and snippets.

@akisute
akisute / gist:1141953
Created August 12, 2011 12:41
Create an animated gif file from images in iOS
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
- (void)exportAnimatedGif
{
UIImage *shacho = [UIImage imageNamed:@"shacho.png"];
UIImage *bucho = [UIImage imageNamed:@"bucho.jpeg"];
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"];
@jacobbubu
jacobbubu / ISOCurrencyCodes.csv
Created February 15, 2012 14:28
iOS Currency Codes
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
ADP Andorran Peseta
AED United Arab Emirates Dirham
AFA Afghan Afghani (1927-2002)
AFN Afghan Afghani
ALK Albanian Lek (1946-1965)
ALL Albanian Lek
AMD Armenian Dram
ANG Netherlands Antillean Guilder
AOA Angolan Kwanza
AOK Angolan Kwanza (1977-1991)
@jacobbubu
jacobbubu / ioslocaleidentifiers.csv
Created February 15, 2012 14:41
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@fmo91
fmo91 / LoadingButton.swift
Created October 4, 2016 17:08
Simple UIButton subclass that can show a customizable loading message
//
// LoadingButton.swift
// LoadingButton
//
// Created by Fernando Ortiz on 4/10/16.
// Copyright © 2016 Fernando Martín Ortiz. All rights reserved.
//
import UIKit
@shaps80
shaps80 / cURL+Request.swift
Last active July 18, 2024 14:25
Generates a cURL command representation of a URLRequest in Swift.
import Foundation
extension URLRequest {
/**
Returns a cURL command representation of this URL request.
*/
public var curlString: String {
guard let url = url else { return "" }
var baseCommand = #"curl "\#(url.absoluteString)""#
@fmo91
fmo91 / ReusableViewEnum.swift
Last active August 16, 2017 20:39
Protocol extension to help using UITableView protocols in a better way.
protocol ReusableViewEnum {}
extension ReusableViewEnum where Self: RawRepresentable, Self.RawValue == Int {
static var all: [Self] {
var index = 0
var allItems = [Self]()
while let item = Self(rawValue: index) {
allItems.append(item)
index += 1
}
@TheCodedSelf
TheCodedSelf / RxSwiftBindToButton.swift
Created May 13, 2017 17:16
RxSwift: Bind to button taps
import UIKit
import RxSwift
import RxCocoa
let button = UIButton()
button.rx.tap.bind {
print("button tapped")
}
@Pulimet
Pulimet / AdbCommands
Last active July 27, 2024 14:17
Adb useful commands list
Hi All!
I've recently launched a tool that wraps many of the commands here with a user interface. This desktop application is currently available for macOS. There's a roadmap outlining planned features for the near future.
Feel free to request any features you'd like to see, and I'll prioritize them accordingly.
One of the most important aspects of this application is that every command executed behind the scenes is displayed in a special log section. This allows you to see exactly what’s happening and learn from it.
Here's the link to the repository: https://github.com/Pulimet/ADBugger
App Description:
ADBugger is a desktop tool designed for debugging and QA of Android devices and emulators. It simplifies testing, debugging, and performance analysis by offering device management, automated testing, log analysis, and remote control capabilities. This ensures smooth app performance across various setups.
@cprovatas
cprovatas / Data+PrettyPrint.swift
Created May 23, 2018 15:52
Pretty print JSON string from Data in Swift 4.1 (especially useful printing to Xcode console)
import Foundation
extension Data {
var prettyPrintedJSONString: NSString? { /// NSString gives us a nice sanitized debugDescription
guard let object = try? JSONSerialization.jsonObject(with: self, options: []),
let data = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted]),
let prettyPrintedString = NSString(data: data, encoding: String.Encoding.utf8.rawValue) else { return nil }
return prettyPrintedString
}
@fmo91
fmo91 / FunctionalNetworkingLayer.swift
Last active July 19, 2020 00:24
Toy Networking Layer with functional operators
import Foundation
import PlaygroundSupport
enum NetworkError: Error {
case generic
}
precedencegroup PipeAssociativity {
associativity: left
}