Skip to content

Instantly share code, notes, and snippets.

View franciscoamado's full-sized avatar

Francisco Amado franciscoamado

View GitHub Profile

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@franciscoamado
franciscoamado / libdispatch-efficiency-tips.md
Created November 23, 2020 16:49 — forked from tclementdev/libdispatch-efficiency-tips.md
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

@franciscoamado
franciscoamado / Xcode Breakpoints.swift
Created November 3, 2020 16:52 — forked from tylermilner/Xcode Breakpoints.swift
These are Xcode breakpoints I've found to be very useful to have turned on to help debug iOS applications and spot problems early. After creating each one, right-click on it and click "Move Breakpoint To" -> "User" so that the breakpoint will automatically be active for any Xcode project you open.
All Objective-C Exceptions
// Catches exceptions thrown by Objective-C code.
// Default Xcode breakpoint created by clicking "+" to add breakpoint -> "Exception Breakpoint".
// Change "Exception: All" to "Exception: Objective-C".
-[UIApplication main]
// Helps when printing objects via the debugger by making it aware of the classes in UIKit.
// Symbolic breakpoint created by clicking "+" to add breakpoint -> "Symbolic Breakpoint".
// Enter "-[UIApplication main]" for the Symbol.
// Choose Action -> "Debugger Command".
@franciscoamado
franciscoamado / enable-xcode-debug-menu.sh
Created March 2, 2020 11:14 — forked from dsabanin/enable-xcode-debug-menu.sh
Enable internal Xcode debug menu in Xcode 11
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -bool YES
sudo mkdir -p /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode
sudo touch /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode/AppleInternal.plist
# Don't forget to restart Xcode
@franciscoamado
franciscoamado / mr-reminder.rb
Created February 11, 2020 16:22 — forked from a-voronov/mr-reminder.rb
Gitlab Merge Requests Reminder
require 'getoptlong'
require 'gitlab'
opts = GetoptLong.new(
['--help', '-h', GetoptLong::NO_ARGUMENT],
['--endpoint', '-e', GetoptLong::REQUIRED_ARGUMENT],
['--token', '-t', GetoptLong::REQUIRED_ARGUMENT],
['--group', '-g', GetoptLong::REQUIRED_ARGUMENT],
['--webhook', '-w', GetoptLong::REQUIRED_ARGUMENT]
)
@franciscoamado
franciscoamado / FrameSpy.tsx
Created November 27, 2019 12:01 — forked from davo/FrameSpy.tsx
FrameSpy - Refactor
import * as React from 'react'
import { addPropertyControls, ControlType, FrameProps, Frame } from 'framer'
import reactElementToJSXString from 'react-element-to-jsx-string'
import Highlight, { defaultProps } from 'prism-react-renderer'
import { themes } from './themes'
import Clipboard from 'react-clipboard.js'
// @steveruizok
// Define type of property
@franciscoamado
franciscoamado / loadcustomfonts.swift
Created November 25, 2019 15:49
Programmatically load custom fonts in iOS
import Foundation
import UIKit
public extension UIFont {
@discardableResult
static func load(customFont name: String, ofType format: String, from bundle: Bundle = Bundle.main) -> Bool {
guard let url: String = bundle.url(forResource: name, withExtension: format) else { return false }
@franciscoamado
franciscoamado / One Dark Pro.itermcolors
Created November 21, 2019 14:54
One Dark Pro Colors for iTerm2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.22352941334247589</real>
@franciscoamado
franciscoamado / UIView+Utility.swift
Created January 8, 2019 09:44 — forked from joshavant/UIView+Utility.swift
Ambiguity Treadmill
extension UIView {
@objc func exerciseAmbiguityInLayoutRepeatedly() {
if self.hasAmbiguousLayout {
Timer.scheduledTimer(timeInterval: 0.5,
target: self,
selector: #selector(UIView.exerciseAmbiguityInLayout),
userInfo: nil,
repeats: true)
}
}
@franciscoamado
franciscoamado / GIF-Screencast-OSX.md
Last active December 6, 2017 10:51 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: