Skip to content

Instantly share code, notes, and snippets.

View alexito4's full-sized avatar

Alejandro Martínez alexito4

View GitHub Profile
@alexito4
alexito4 / sessionslist.txt
Created June 6, 2018 18:39
WWDC 18 List of Sessions
What's New in Swift
Creating Apps for a Global Audience
Introducing Podcast Analytics
What's New in Cocoa Touch
Using Accelerate and simd
Live Screen Broadcast with ReplayKit
I Have This Idea For An App...
Automatic Strong Passwords and Security Code AutoFill
Measuring and Optimizing HLS Performance
What’s New in ARKit 2
@alexito4
alexito4 / keybase.md
Created February 11, 2016 11:06
keybase.md

Keybase proof

I hereby claim:

  • I am alexito4 on github.
  • I am alejandromp (https://keybase.io/alejandromp) on keybase.
  • I have a public key whose fingerprint is F281 C10D C3E7 50B6 E256 ABCC DB9D C4B2 043A 15C9

To claim this, I am signing this object:

@alexito4
alexito4 / hang.swift
Last active September 4, 2015 07:00
Is this not valid in Swift? Tried on Xcode 7b6
protocol Stack {
typealias Element
mutating func push(value: Element)
mutating func pop() -> Element?
}
struct ArrayStack<T>: Stack {
....
@alexito4
alexito4 / srly.rb
Created January 26, 2015 19:05
Download youtube videos form the safari reading list. More info at: http://www.alejandromp.com/blog/2015/1/26/download-youtube-videos-from-the-safari-reading-list
require 'nokogiri-plist'
require 'uri'
class SRLItem
attr_accessor :title
attr_accessor :url
attr_accessor :source
def initialize(dict)
@alexito4
alexito4 / Amazing.h
Last active August 29, 2015 14:14
Add XCTest at runtime
#import <Foundation/Foundation.h>
#import "Smiler.h"
@interface Amazing : NSObject <Smiler>
@end
local wait = 60
os.loadAPI("weather")
local city = "London,uk"
while true do
local commandBlock = peripheral.wrap("back")
local w = weather.getWeather(city)
@alexito4
alexito4 / gist:5be48be412d4aa44c60c
Created August 30, 2014 10:00
Understanding Value and Reference Types in Swift
// Understanding Value and Reference Types in Swift
/*
One of the coolest parts about Swift is how powerful all the types are. Structs are not like basic C structs, they have a lot of similarities with classes, and the same goes for the Enums. This is really good but also comes with the risk that newcomers doesn't know the differences between them. The oficial Swift blog has a great post about [Value and Reference Types](https://developer.apple.com/swift/blog/?id=10), read it.
In this post/playground I want to go step by step in some cases that will help newcomers understand how the different types work in Swift. It's good for people that comes form Objective-C to understand how Swift still has pointers, but hidden behind the language to make it safe. And for the newcomers, that doesn't know much about programming or *pointers*, will be good to understand what's actually happening behind the scenes.
## Categorization
Swift has two categories of Types: Value and Reference.
@alexito4
alexito4 / playground
Created August 26, 2014 18:55
Swift extensions and inheritance
import UIKit
protocol Thing {
func name() -> String
}
protocol God {
func talk() -> String
}
#import <Foundation/Foundation.h>
// typedef
typedef NSString*(^ConvertBlock)(NSString *text);
@interface Thing : NSObject
@property (nonatomic, strong) void (^coolPropertyBlock)(NSString *text); // Property
// method param
- (void)doSomething:(void(^)(NSString *text))block with:(NSString *)person;
@alexito4
alexito4 / enums.playground
Last active August 12, 2019 06:32
Swift enums and UISegmentedControl
import UIKit
enum Size: Int, CustomStringConvertible {
case S = 0
case M
case L
case XL
static func allValues() -> [String] {