Skip to content

Instantly share code, notes, and snippets.

View amadeu01's full-sized avatar
:octocat:
Working from Stockholm

Amadeu Cavalcante Filho amadeu01

:octocat:
Working from Stockholm
View GitHub Profile
@skymobilebuilds
skymobilebuilds / carthage-xc12.sh
Last active May 17, 2022 12:36
Xcode 13 and 12 Carthage Build Workaround
#!/bin/bash -e
echo "🤡 Applying carthage 12 and 13 workaround 🤡"
xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
# the build will fail on lipo due to duplicate architectures.
CURRENT_XCODE_VERSION=$(xcodebuild -version | grep "Build version" | cut -d' ' -f3)
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' > $xcconfig
echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$CURRENT_XCODE_VERSION = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig
@jonesd
jonesd / ImportingMobileVLCKitIntoAnIOSFramework.md
Created January 9, 2020 21:22
Including MobileVLCKit in a iOS Framework Module

Including MobileVLCKit in a iOS Framework Module

pod.spec

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '11.0'
project 'XXX'

use_frameworks!
// Created by Amadeu Cavalcante Filho on 11/05/19.
// Copyright © 2019 Amadeu Cavalcante Filho. All rights reserved.
//
import Foundation
public struct Task<T, E: Error> {
public typealias Closure = (Controller<T, E>) -> Void
private let closure: Closure
@gabrieltodaro
gabrieltodaro / UIView+Anchors.swift
Last active August 25, 2023 17:10
UIView extension for use with anchors. This allows you to create views programmatically withou problems.
//
// Anchor.swift
// Todaro
//
// Created by Gabriel Patané Todaro on 18/02/19.
// Copyright © 2019 Todaro. All rights reserved.
//
import UIKit
@joscdk
joscdk / env.md
Created December 5, 2018 14:45
Using .env files in Vapor 3

.env files can be an easy way to setup Environment variables locally. You can start using a .env files in Vapor 3 by following this small guide.

First setup the vapor-ext package in your Package.swift file:

.package(url: "https://github.com/vapor-community/vapor-ext.git", from: "0.1.0"),

Next create a .env file in the root of your project:

public struct BoundedSequence<Base>: Sequence, IteratorProtocol where Base: Sequence {
public struct Boundary: Equatable {
public let isStart: Bool
public let isEnd: Bool
}
private var _iterator: Base.Iterator
private var _previous: Base.Element?
private var _current: Base.Element?
private var _next: Base.Element?
@sdeleuze
sdeleuze / kotlin-frontend.md
Last active October 25, 2022 14:50
My call for Kotlin as a major frontend language

My call for Kotlin as a major frontend language

I try to push for quite a long time for first class support for WebAssembly in Kotlin because I really believe that frontend development is a domain where Kotlin can be as strong as in mobile, and because this is something that would also help to increase even more the adoption on server-side.

I truly appreciate all the work already done by Kotlin/JS and Kotlin/Native teams. The dead code elimination tool and the initial WebAssembly support in Kotlin/Native are important steps in the right direction. But I believe that Kotlin needs now to make frontend a real priority to take it to the next level.

Need for a consistent and unified web frontend strategy

The first point I would like to raise is that what Kotlin needs IMO is a consistent strategy about web frontend wich includes both Javascript and WebAssembly related efforts. I can u

@IanKeen
IanKeen / Example+Object.swift
Last active August 2, 2023 16:39
Simple, highly composable Validator
extension Validator where Input == User, Output == User {
static var validUser: Validator<User, User> {
return .keyPath(\.name, .isNotNil && .isNotEmpty)
}
}
struct User {
let name: String?
}
@murki
murki / PlacesActivity.kt
Last active June 10, 2021 03:59
The poor man's Dagger: Exemplifying how to implement dependency injection on Android by (ab)using ApplicationContext's getSystemService(). Here we attain inversion of control without the need of any external library. We also use Kotlin's extension methods to provide a friendlier, strongly-typed API to locate dependencies.
class PlacesActivity : AppCompatActivity() {
private lateinit var placesPresenter: PlacesPresenter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// This is how you instantiate your Presenter while the service locator resolves all of its dependencies
// Note that the explicit type argument <PlacesPresenter> is not even necessary since Kotlin can infer the type
placesPresenter = application.getSystemService<PlacesPresenter>()
}
}
@beloso
beloso / flat-swift4-noncaching.stencil
Created May 8, 2018 16:04
SwiftGen non caching Strings template
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen
{% if tables.count > 0 %}
{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %}
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
{% macro parametersBlock types %}{% filter removeNewlines:"leading" %}
{% for type in types %}