Skip to content

Instantly share code, notes, and snippets.

View unnamedd's full-sized avatar
🇺🇦
#StandWithUkraine

Thiago Holanda unnamedd

🇺🇦
#StandWithUkraine
View GitHub Profile
@unnamedd
unnamedd / main.swift
Created February 10, 2016 02:09
Basic Authentication Middleware - Zewo - Example
import Flux
var basicAuth = BasicAuthenticationMiddleware(username: "admin", password: "password")
let router = Router(middleware: logger, basicAuth) { route in
route.get("/") { request in
var content: [String: InterchangeData] = ["id": 2348, "title": "Blood Brother", "artist": "Iron Maiden"]
@unnamedd
unnamedd / puller.sh
Created April 15, 2016 12:10
script to walk through zewo flux folders and pull data from branch SNAPSHOT-2016-04-12
#!/bin/bash
for i in $(ls -d */); do
if [ ! $i = "Flux.xcodeproj/" ]; then
cd ${i%%/};
printf "\n\n##### ${i%%/}\n"
for f in $(ls -d */); do
cd ${f%%/};
printf "${f%%/}"
@unnamedd
unnamedd / Parallaxable.swift
Created April 22, 2016 16:44 — forked from bbheck/Parallaxable.swift
Protocolo que permite que a UITableViewCell faça um efeito de parallax.
/**
Protocolo responsável por fazer o efeito de parallax nas imagens que, principalmente, são usadas como background.
É necessário chamar a função `setupParallaxInitialValues` no `awakeFromNib` da `UITableViewCell` para configurar os valores iniciais das variáveis.
Além disso, para total funcionamento do efeito, é necessário implementar algumas chamadas na `UIViewController` ou `UITableViewController` que a `tableView` está instanciada.
Chamar a função `setParallaxCellImageOffsetWithTableView` no `willDisplayCell` da `UITableViewDelegate` e para todas as células visíveis no método `scrollViewDidScroll`.
Implementação:
@unnamedd
unnamedd / ReplaceChar.swift
Created August 22, 2016 06:41
NSTextAttachment
// MARK: - String Extension
private extension String {
/**
replace characters from the original text to some image
- parameter character: the character that will be used to be replaced by image
- parameter image: image name that will replace the character
*/
func replace(char character: String, image: String) -> NSAttributedString {
@unnamedd
unnamedd / CreditCard.swift
Last active August 30, 2016 06:44 — forked from cwagdev/CreditCard.swift
Credit Cards represented in Swift
//
// Created by Chris Wagner
// https://gist.github.com/cwagdev/e66d4806c1f63fe9387a
//
// Modified by Thiago Holanda (August/2016)
//
// These modifications was made to support the latest version of Swift
// before the major version (3.0) is released. This code will compile
// without any problem on Swift 2.2.
//
@unnamedd
unnamedd / Enums+Extensions.swift
Last active March 29, 2019 23:51
How to use the right methods to right types
// Common - Portuguese - pt-BR.lproj/Localizable.strings
// "common.change" = "Mudar";
// "common.error" = "Erro";
// "common.delete" = "Exluir";
// "common.wait" = "Aguarde";
// Common - English - en.lproj/Localizable.strings
// "common.change" = "Change";
// "common.error" = "Error";
// "common.delete" = "Delete";
@unnamedd
unnamedd / spaceship-list-apps.rb
Created November 4, 2016 14:12
List Release Versions
require "spaceship"
Spaceship::Tunes.login("<apple-id-account>", "<password>")
bundle_ids = Array.new
bundle_ids.push("br.com.example.app")
bundle_ids.each do |bundle_id|
app = Spaceship::Tunes::Application.find(bundle_id)
app.edit_version.candidate_builds.each do |build|
puts "TestFlight - #{bundle_id} - Train Version: #{build.train_version} - Build: #{build.build_version}"
@unnamedd
unnamedd / CustomStructToEnum.swift
Last active February 21, 2018 17:51
[Swift] Using different structs into Enum
public struct Type {
var id: Int
var name: String
var description: String
public init(id: Int, name: String? = nil, description: String? = nil) {
self.id = id
self.name = name ?? ""
self.description = description ?? ""
}
@unnamedd
unnamedd / learn-swift-step-by-step
Last active February 21, 2018 17:51
Step by step to learn Swift, by Lisa Dziuba https://github.com/LisaDziuba // https://twitter.com/LisaDziuba
Lisa Dziuba [10:01]
@artnosenko hi, here is my list, which I used when started learning Swift
1. Apple guides :pray:
https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/index.html#//apple_ref/doc/uid/TP40015214-CH2-SW1
2. Stanford lectures (free!) :
https://itunes.apple.com/in/course/developing-ios-10-apps-swift/id1198467120
3. raywenderlich.com tutorials
@unnamedd
unnamedd / Playground.swift
Last active February 21, 2018 17:51
Extension UIView to add borders in partnership with @diegoventura and @brunogb
import UIKit
import PlaygroundSupport
extension UIView {
private class UIViewNamed: UIView {
var name: String
var thickness: CGFloat? = nil
required init(frame: CGRect = CGRect.zero, name: String) {
self.name = name