Skip to content

Instantly share code, notes, and snippets.

Tiago Martinho tiagomartinho

Block or report user

Report or block tiagomartinho

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View coffe-machine.md

Project

In this Coffee Machine Project, your task is to implement the logic (starting from a simple class) that translates orders from customers of the coffee machine to the drink maker. Your code will use the drink maker protocol to send commands to the drink maker.

First iteration - Making drinks

In this iteration, your task is to implement the logic (starting from a simple class) that translates orders from customers of the coffee machine to the drink maker. Your code will use the drink maker protocol (see below) to send commands to the drink maker.

The coffee machine can serves 3 type of drinks: tea, coffee, chocolate.

Use cases

Your product owner has delivered the stories and here they are:

View UIViewLayoutAnchors.swift
// Inspired by UIView Anchors from Brian Voong. Please check out his work at https://github.com/bhlvoong/LBTAComponents
extension UIView {
public func addSubViewList(_ view: UIView...) {
view.forEach { self.addSubview($0) }
}
public func fillSuperview() {
translatesAutoresizingMaskIntoConstraints = false
if let superview = superview {
@joshdholtz
joshdholtz / .env
Last active Aug 12, 2019
Using Dotenv and environment variables with fastlane
View .env
STUFF = this is some stuff
@lattner
lattner / async_swift_proposal.md
Last active Aug 25, 2019 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift
View async_swift_proposal.md

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@nunogoncalves
nunogoncalves / Dates.swift
Last active Feb 7, 2019
Date Operations in swift 3 //Date() + 1.days
View Dates.swift
//See the bottom of this file to check what you can do with this
let calendar = Calendar(identifier: .gregorian)
struct CalendarComponentAmount {
let component: Calendar.Component
let amount: Int
}
infix operator +: AdditionPrecedence
View FocusTextView.swift
// TextView subclass that replicates TVOS movies app
// Also made a quick presentation controller
// Just connect the delegate to the ViewController in IB
// and set the TextView class to FocusTextView
import UIKit
class TextPresentationViewController:UIViewController {
let label = UILabel()
let blurStyle = UIBlurEffectStyle.Dark
@yoichitgy
yoichitgy / mergegenstrings.py
Last active May 28, 2019
A script to generate .strings file for .swift, .m, .storyboard and .xib files by genstrings and ibtool commands, and merge them with existing translations.
View mergegenstrings.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Localize.py - Incremental localization on XCode projects
# João Moreno 2009
# http://joaomoreno.com/
# Modified by Steve Streeting 2010 http://www.stevestreeting.com
# Changes
# - Use .strings files encoded as UTF-8
@jezen
jezen / Io Example Problems
Created Dec 15, 2013
The example problems have gone missing from the Io language website, so here’s a backup.
View Io Example Problems
#Sample code
#Hello world
"Hello world!" print
#Factorial
factorial := method(n, if(n == 1, 1, n * factorial(n - 1)))
99 bottles of beer
@jellybeansoup
jellybeansoup / cltools.sh
Last active Dec 31, 2018
Install Autoconf and Automake on OS X Mountain Lion
View cltools.sh
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
@aitskovi
aitskovi / GestureImage.m
Created Mar 4, 2011
A pannable, rotatable and zoomable image with gesture recognizers.
View GestureImage.m
- (id)initWithImage:(UIImage *)image {
if ((self = [super initWithImage:image])) {
self.userInteractionEnabled = YES;
self.multipleTouchEnabled = YES;
_pinchGestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchRecognized:)];
[self addGestureRecognizer:_pinchGestureRecognizer];
_pinchGestureRecognizer.delegate = self;
_panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panRecognized:)];
[self addGestureRecognizer:_panRecognizer];
_panRecognizer.delegate = self;
You can’t perform that action at this time.