Skip to content

Instantly share code, notes, and snippets.

View FranDepascuali's full-sized avatar

Depa FranDepascuali

View GitHub Profile
@FranDepascuali
FranDepascuali / Fastfile.rb
Last active December 6, 2024 01:57
Publish a new fastlane version of a RN iOS app
# Import the iOS-specific Fastlane configuration
import("../ios/fastlane/ios_fastfile")
# Shared lanes for version management and release notes generation
lane :get_version_from_tag do |options|
# Ensure required environment variables are present
ensure_env_vars(
env_vars: ['GIT_TAG']
)
@FranDepascuali
FranDepascuali / santi.py
Created August 29, 2022 19:08
Python santi
import wikiquotes
print("Hola Santi")
edad_santi = 30
edad_fran = 30
edad_santi_texto = "30"
edadSanti = 30
asdsadjasjdj = 30
// Just playing with this pointfreeco sample
// https://github.com/pointfreeco/episode-code-samples/blob/main/0114-designing-dependencies-pt5/DesigningDependencies/WeatherClient/Sources/WeatherClient/Mocks.swift
extension WeatherClient {
static func faked(
response: Result<[WeatherResponse.ConsolidatedWeather], Error>,
locations: Result<[Location], Error>) -> WeatherClient {
return Self(
weather: { _ in
@FranDepascuali
FranDepascuali / XCTAssertDeallocation.swift
Last active August 22, 2020 12:57
A sample for testing memory leaks
// Adapted from https://www.avanderlee.com/swift/memory-leaks-unit-tests/
// --------------> Usage <-------------------
XCTAssertDeallocation(of: {
MyViewController(...)
})
// With some setup:
XCTAssertDeallocation(of: { () -> MyViewController in
let myViewController = MyViewController(...)
import Foundation
protocol UserProvider {
func logIn(onSuccess: (User) -> (), onFailure: (Error) -> ())
}
protocol UserRepositoryProtocol {
}
@FranDepascuali
FranDepascuali / Action.swift
Created February 28, 2020 03:55
Decode and encode complex json
import Foundation
let jsonString: String = """
{ "action": {"dynamicKey": [{"active": false}]},
"schedule": "00 09 * * 1,2,3,4,5",
"tz": "America.Chicago"}
"""
let jsonData = jsonString.data(using: .utf8)!
struct Action {
@FranDepascuali
FranDepascuali / boot_app_multiple_simulators.rb
Last active March 22, 2022 19:35
Builds iOS app (only once) for multiple simulators.
DEFAULT_SIMULATORS = ['iPhone 5s', 'iPhone 8', 'iPhone X', 'iPhone Xʀ']
PROJECT_PATH = # Project path.
SCHEME = ... # (Your scheme)
CONFIGURATION = ... # (usually Debug or Release)
APP_ID = # Your app id. i.e: com.company.app
APP_NAME = # The output name of your app.
platform :ios do
@FranDepascuali
FranDepascuali / bar.js
Created September 7, 2018 16:33
bar vs foo
function* watchTokenExpire() {
let action = yield take(UPDATE_TOKEN_EXPIRE);
while (true) {
if (action.payload.shouldRefresh) {
yield fetchNewTokenOrLogout();
} else {
const expireInMs = (action.payload.expireIn * 1000) - MIN_TOKEN_LIFESPAN;
const raceResult = yield race({
action: take(UPDATE_TOKEN_EXPIRE),
timeout: delay(expireInMs),
@FranDepascuali
FranDepascuali / rpi-config.sh
Created August 25, 2017 19:48
Raspberry PI configuration
# Raspberry PI (RPI) 3 configuration with Mac OSx.
# 1) Connect SD card to mac (you would need an adapter).
# 2) Find the disk partition.
diskutil list
# 3) Once located, format SD card to FAT32. <disk> was /dev/disk0 in my case.
sudo diskutil eraseDisk FAT32 RASPBIAN MBRFormat <disk>
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->