Skip to content

Instantly share code, notes, and snippets.

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

Tiago Braga tiagobbraga

🏠
Working from home
View GitHub Profile
@tiagobbraga
tiagobbraga / preferences-xcode.txt
Last active October 17, 2025 19:39
Reset preferences Xcode
defaults delete com.apple.dt.Xcode
rm -rf $HOME/Library/Application\ Support/Developer/Shared/Xcode
rm -rf $HOME/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState
rm -rf $HOME/Library/Preferences/com.apple.dt.Xcode.*
@tiagobbraga
tiagobbraga / increment-build-number-agvtool.txt
Last active September 23, 2025 13:47
Increment Build Number with agvtool
To enable agvtool in an Xcode project, follow these steps:
Select your project and target: Open your Xcode project and select your project in the Project Navigator. Then, select the target you want to configure agvtool for.
Access Build Settings: Go to the "Build Settings" tab for your selected target.
Configure Versioning System:
Configure Versioning System:
- Search for "versioning" in the search bar.

Note: YouTube is serving thumbnails from 2 servers:

  • //img.youtube.com
  • //i.ytimg.com

Examples are with //i.ytimg.com server just because it’s shorter, no other particular reason. You can use both.

  • Player Background Thumbnail (480x360):

@tiagobbraga
tiagobbraga / SSH
Created January 19, 2024 20:34 — forked from mingderwang/log
add a public key for new host to ssh aws ec2
1. make a new public on local host (generate public key under ~/.ssh)
cd
ssh-keygen -t rsa -b 1024
2. copy the output of the following cat.
cat ~/.ssh/id_rsa.pub
3. ssh to your aws ec2 and paste it to ~/.ssh/authorized_keys2 (a new file)
@tiagobbraga
tiagobbraga / podforceupdate.sh
Created July 28, 2023 19:43 — forked from mbinna/podforceupdate.sh
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@tiagobbraga
tiagobbraga / list.txt
Last active May 27, 2022 18:14 — forked from adamawolf/Apple_mobile_device_types.txt
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
extension UIHostingController {
convenience public init(rootView: Content, ignoreSafeArea: Bool) {
self.init(rootView: rootView)
if ignoreSafeArea {
disableSafeArea()
}
}
func disableSafeArea() {
import Foundation
// Inspired by https://gist.github.com/mbuchetics/c9bc6c22033014aa0c550d3b4324411a
struct JSONCodingKeys: CodingKey {
var stringValue: String
init?(stringValue: String) {
self.stringValue = stringValue
}
@tiagobbraga
tiagobbraga / next-hoc.js
Created June 12, 2021 15:34 — forked from dstreet/next-hoc.js
Example HOC with Next.js
import React from 'react'
/*
* Higher order component that passes `getInitialProps` through
* to the child component
*/
const HOC = function(Child) {
return class Higher extends React.Component {
static getInitialProps(ctx) {
return Child.getInitialProps(ctx)
@tiagobbraga
tiagobbraga / nextjs-hoc-authorization.js
Created June 11, 2021 19:26 — forked from whoisryosuke/nextjs-hoc-authorization.js
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
import React, {Component} from 'react'
import Router from 'next/router'
import AuthService from './AuthService'
export default function withAuth(AuthComponent) {
const Auth = new AuthService('http://localhost')
return class Authenticated extends Component {
static async getInitialProps(ctx) {
// Ensures material-ui renders the correct css prefixes server-side