Skip to content

Instantly share code, notes, and snippets.

View ricardopereira's full-sized avatar
🏠
Working from home

Ricardo Pereira ricardopereira

🏠
Working from home
View GitHub Profile
@ricardopereira
ricardopereira / InteractiveTransitionCollectionViewDeselection.m
Created July 6, 2020 08:03 — forked from smileyborg/InteractiveTransitionCollectionViewDeselection.m
Animate table & collection view deselection alongside interactive transition (for iOS 11 and later)
// UICollectionView Objective-C example
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject];
if (selectedIndexPath != nil) {
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
if (coordinator != nil) {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
@ricardopereira
ricardopereira / GitHub-action-xctest-example.yml
Created June 30, 2020 14:14
GitHub Action example running Xcode tests and caches dependencies
on:
push:
branches:
- develop
name: Build
jobs:
iOS:
name: Unit Tests
runs-on: macOS-latest
strategy:
@ricardopereira
ricardopereira / RaspberryPi_A_Plus_Wifi.md
Created June 21, 2020 15:22 — forked from dpapathanasiou/RaspberryPi_A_Plus_Wifi.md
How to setup a usb wifi dongle on the Raspberry Pi Model A+

Rationale

The Raspberry Pi Model A+ has just a single usb port, so getting the wifi configured has to done by editing /etc/network/interfaces from a command line prompt.

These instructions assume the Raspbian OS on the SD card, and a usb wifi adapter that supports the RTL8192cu chipset, since the current Raspbian has built-in support for it.

Before the first boot

  1. Put a keyboard in the usb slot
  2. Connect the HDMI slot to a monitor
Test Case '-[Ably_iOS_Tests.RealtimeClient RealtimeClient__subscriber_should_receive_messages_in_the_same_order_in_which_they_have_been_sent]' started.
2020-05-09 09:26:14.188371+0100 xctest[39899:1401602] DEBUG: (ARTAuth.m:162) RS:0x7fe5bde17c60 validating <ARTClientOptions: 0x7fe5bde14370> -
key: _tmp_P6etwg.hMclYg:8eIR1wiiS15Cp1Oi;
token: (null);
authUrl: (null);
authMethod: GET;
hasAuthCallback: 0;
clientId: (null);
2020-05-09 09:26:14.188779+0100 xctest[39899:1401602] DEBUG: (ARTAuth.m:168) RS:0x7fe5bde17c60 setting up auth method Basic (anonymous)
2020-05-09 09:26:14.189331+0100 xctest[39899:1401602] DEBUG: RT:0x7fe5bde133d0 realtime is transitioning from 0 - Initialized to 1 - Connecting
@ricardopereira
ricardopereira / FadeScrollView.swift
Created May 20, 2020 09:07 — forked from luismachado/FadeScrollView.swift
Custom UIScrollView with fade effect
//
// FadeScrollView.swift
//
// Created by Luís Machado on 23/06/2017.
// Copyright © 2017 Luis Machado. All rights reserved.
//
import UIKit
class FadeScrollView: UIScrollView, UIScrollViewDelegate {
@ricardopereira
ricardopereira / FileManagerExtensions.swift
Created December 3, 2019 16:43 — forked from AvdLee/FileManagerExtensions.swift
Easily print out useful locations for usage during debugging on the Simulator.
extension FileManager {
/*
Prints out the locations of the simulator and the shared group folder.
This is useful for debugging file issues.
Example usage: FileManager.default.printFileLocations()
*/
func printFileLocations() {
let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
let simulatorFolder = paths.last!
{"app_name":"AblyExperiments","timestamp":"2019-09-10 14:34:22.48 +0100","app_version":"5.0.0","slice_uuid":"11188f0c-94b3-3dc1-807e-c42871d3f182","adam_id":0,"build_version":"6","bundleID":"co.whitesmith.AblyPush","share_with_app_devs":true,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 12.4.1 (16G102)","incident_id":"E4EDEE86-0651-4CB6-9514-6707BD3421CA","name":"AblyExperiments"}
Incident Identifier: E4EDEE86-0651-4CB6-9514-6707BD3421CA
CrashReporter Key: 68c5411c7ef2407aae11b258787da2d89c0fad3a
Hardware Model: iPhone10,6
Process: AblyExperiments [1685]
Path: /private/var/containers/Bundle/Application/CB0D3653-C823-471D-AFF4-75101913FD43/AblyExperiments.app/AblyExperiments
Identifier: co.whitesmith.AblyPush
Version: 6 (5.0.0)
Code Type: ARM-64 (Native)
Role: Non UI
import Foundation
final class SafeSyncQueue {
struct QueueIdentity {
let label: String
}
let queue: DispatchQueue
@ricardopereira
ricardopereira / carthage-filelist.swift
Last active July 7, 2019 13:53
Generate Input and Output Filelist to use in projects with Carthage frameworks
#!/usr/bin/swift sh
import Foundation
import Path // mxcl/Path.swift ~> 0.16
print("Current Directory:", Path.cwd)
extension Array where Element == Entry {
var frameworks: [Path] {
return directories.frameworks
final class Loader: BindableObject {
let didChange = PassthroughSubject<Data?, Never>()
var task: URLSessionDataTask!
var data: Data? = nil {
didSet {
didChange.send(data)
}
}
init(_ url: URL) {