Skip to content

Instantly share code, notes, and snippets.

Avatar
⌨️

Flávio Caetano fjcaetano

⌨️
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am fjcaetano on github.
  • I am fjcaetano (https://keybase.io/fjcaetano) on keybase.
  • I have a public key ASBPByTOBjczHP-AUH3vIlMW7Lq2bslvhRAJTTU63iW6ego

To claim this, I am signing this object:

@fjcaetano
fjcaetano / withPure.tsx
Created Dec 11, 2018
Pure React component HOC in Typescript
View withPure.tsx
import React from 'react';
const withPure = <P extends any>(
WrappedComponent: React.ComponentType<P>,
): React.ComponentClass<P> => {
class Purified extends React.PureComponent<P> {
render() {
return <WrappedComponent {...this.props} />;
}
}
View DispatchQueue+DebounceThrottle.swift
import Dispatch
private var throttleWorkItems = [AnyHashable: DispatchWorkItem]()
private var lastDebounceCallTimes = [AnyHashable: DispatchTime]()
private let nilContext: AnyHashable = arc4random()
public extension DispatchQueue {
/**
- parameters:
- deadline: The timespan to delay a closure execution
@fjcaetano
fjcaetano / ios_simulator.rb
Created Nov 13, 2017
iOS Simulator launcher Fastlane action
View ios_simulator.rb
module Fastlane
module Actions
module SharedValues
IOS_SIMULATOR_CUSTOM_VALUE = :IOS_SIMULATOR_CUSTOM_VALUE
end
class IosSimulatorAction < Action
@@already_booted_code = 164
def self.run(params)
@fjcaetano
fjcaetano / codecov.rb
Last active Feb 8, 2021
Codecov Fastlane action
View codecov.rb
module Fastlane
module Actions
class CodecovAction < Action
def self.run(params)
ci_only = params[:ci_only]
cmd = ['curl -s https://codecov.io/bash | bash']
cmd << "-s --" if params.all_keys.inject(false) { |p, k| p or params[k] }
cmd << "-X xcodeplist" if params[:use_xcodeplist]
cmd << "-J '#{params[:project_name]}'" if params[:project_name]
View ChallengeViewController.swift
//
// ChallengeViewController.swift
// WinninApp
//
// Created by Flávio Caetano on 9/26/16.
// Copyright © 2016 Winnin. All rights reserved.
//
import UIKit
import RxSwift
@fjcaetano
fjcaetano / changelog.sh
Last active Mar 3, 2016
Changelog from previous tag
View changelog.sh
echo "Printing Changelog"
git log $(git describe --abbrev=0)..HEAD --pretty=oneline --abbrev-commit | envman add --key GIT_CHANGELOG
echo $GIT_CHANGELOG
@fjcaetano
fjcaetano / version_bumper.sh
Created Sep 3, 2015
Xcode Version Bumper
View version_bumper.sh
bN=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
bN=$(($bN + 1))
bN=$(printf "%d" $bN)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bN" "${PROJECT_DIR}/${INFOPLIST_FILE}"
@fjcaetano
fjcaetano / build.sh
Created Sep 3, 2015
Universal Framework Build Script
View build.sh
#!/bin/sh
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: Detected, stopping"
else
View :poop:Sort.swift
var randomNumbers = [42, 12, 88, 62, 63, 56, 1, 77, 88, 97, 97, 20, 45, 91, 62, 2, 15, 31, 59, 5]
randomNumbers
func 💩Sort(arr: Int[]) -> Int[] {
var array = arr.copy()
// Private function to check whether or not the array is sorted
func isSorted (arr: Int[]) -> Bool {