Skip to content

Instantly share code, notes, and snippets.

View kvdesa's full-sized avatar

Kévin Cardoso de Sá kvdesa

View GitHub Profile
@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)
@mgibowski
mgibowski / git-revert-sha-commit
Created August 1, 2012 08:46
[git] revert to a commit by sha hash
# found at:
# http://stackoverflow.com/questions/1895059/git-revert-to-a-commit-by-sha-hash
# reset the index to the desired tree
git reset --hard 56e05fced
# move the branch pointer back to the previous HEAD
git reset --soft HEAD@{1}
git commit -m "Revert to 56e05fced"
@lamprosg
lamprosg / 1.Theory.mm
Last active May 4, 2022 16:37
(iOS) Touches, taps and Gestures
//Touch events must be implemented in the class for ex. of the control that should handle it. If it doesn't it has to be
//implemented in the parent class (ex. if not in the uicontrol, uibutton,table cell, tableview etc then it will go to UIView.
//If UIView won't handle it, then it will go to the ViewController class. It can end up to the appdelegate class).
//You have to call the parent's function that will implement the event manually
//Four methods are used to notify a responder about touches.
//When the user first touches the screen, the system looks for a responder that has a method called touchesBegan:withEvent:
//Example
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
@ohad7
ohad7 / Tweaks.swift
Last active August 22, 2019 11:49
Mixpanel A/B Testing in Swift
//
// Copyright (c) 2015 Nexar Inc. - All Rights Reserved. Proprietary and confidential.
//
// Unauthorized copying of this file, via any medium is strictly prohibited.
import Foundation
import Mixpanel
public class Tweaks : NSObject, MPTweakObserver {
@samuelbeek
samuelbeek / playground.swift
Created November 16, 2016 16:21
Enums with Associated Values that conform to NSCoding
// Inspiration: https://gist.github.com/NinoScript/47819cf6fe36d6845aee32d19b423e9b
//: Playground - noun: a place where people can play
import UIKit
enum SavableEnum {
case simpleCase
case associatedValue(String)
case anotherAssociated(Int)
}
extension SavableEnum {
@warpling
warpling / extraUIActivityTypes.m
Created November 24, 2016 07:42
Extra UIActivityTypes
// UIActivityTypes
NSString * const UIActivityTypePostToInstagram = @"com.burbn.instagram.shareextension";
NSString * const UIActivityTypeFacebookMessenger = @"com.facebook.Messenger.ShareExtension";
NSString * const UIActivityTypeWhatsApp = @"net.whatsapp.WhatsApp.ShareExtension";
NSString * const UIActivityTypeTelegraph = @"ph.telegra.Telegraph.Share";
NSString * const UIActivityTypeGmail = @"com.google.Gmail.ShareExtension";
NSString * const UIActivityTypeTencent = @"com.tencent.mqq.ShareExtension";
NSString * const UIActivityTypeViber = @"com.viber.app-share-extension";
NSString * const UIActivityTypeTumblr = @"com.tumblr.tumblr.Share-With-Tumblr";
NSString * const UIActivityTypeSkype = @"com.skype.skype.sharingextension";
@AnnieNinaJoyceV
AnnieNinaJoyceV / ODR_ViewController.swift
Created April 29, 2017 06:10
On-Demand Resources - ODR : AppThinning
// Steps to mark ODR resources
// Select file(image, audio, etc) - File inspector - On Demand Resource Tags - Give it a name
class ODR_ViewController: UIViewController {
var tubbyRequest : NSBundleResourceRequest?
@IBOutlet weak var resourceDownloadProgress: UIProgressView! //to show download progress
// fileName is the name of the file's ODR tag
// if you want to download more than 1 file, change String to [String]
func fetchODRResourceWithName(fileName: String) {//to be called when the file needs to be accessed
@NikhilManapure
NikhilManapure / Gif.swift
Last active October 29, 2023 07:31
Create Gif from array of UIImages in Swift 3
import Foundation
import UIKit
import ImageIO
import MobileCoreServices
extension UIImage {
static func animatedGif(from images: [UIImage]) {
let fileProperties: CFDictionary = [kCGImagePropertyGIFDictionary as String: [kCGImagePropertyGIFLoopCount as String: 0]] as CFDictionary
let frameProperties: CFDictionary = [kCGImagePropertyGIFDictionary as String: [(kCGImagePropertyGIFDelayTime as String): 1.0]] as CFDictionary
@htinlinn
htinlinn / DecodableRoot.swift
Last active June 3, 2023 21:10
Decode JSON at root level based on a key
extension JSONDecoder {
func decode<T: Decodable>(_ type: T.Type, from data: Data, keyedBy key: String?) throws -> T {
if let key = key {
// Pass the top level key to the decoder.
userInfo[.jsonDecoderRootKeyName] = key
let root = try decode(DecodableRoot<T>.self, from: data)
return root.value
} else {
@simme
simme / UITabBarController+ToggleTabBar.swift
Created January 25, 2018 15:36
Extension on UITabBarController for hiding/showing the tab bar.
extension UITabBarController {
/**
Show or hide the tab bar.
- Parameter hidden: `true` if the bar should be hidden.
- Parameter animated: `true` if the action should be animated.
- Parameter transitionCoordinator: An optional `UIViewControllerTransitionCoordinator` to perform the animation
along side with. For example during a push on a `UINavigationController`.
*/