Skip to content

Instantly share code, notes, and snippets.

View portellaa's full-sized avatar
🚂
puuuuu puuuuu

Luís Portela Afonso portellaa

🚂
puuuuu puuuuu
View GitHub Profile
@portellaa
portellaa / managed_certificate.md
Last active September 17, 2024 15:49 — forked from fdelu/managed_certificate.md
Managed certificate creation with terraform - Azure Container Apps

variables.tf

variable "env" {
  description = "Environment"
  default     = "dev"
}

variable "app_name" {
  description = "Application name"
@portellaa
portellaa / Default (OSX).sublime-keymap
Last active March 26, 2024 09:06 — forked from lmdemanuel/Default (OSX).sublime-keymap
Sublime Text 3 - User keybindings "a la Xcode"
[
{ "keys": ["super+0"], "command": "toggle_side_bar" },
{ "keys": ["super+shift+o"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["super+shift+y"], "command": "show_panel", "args": {"panel": "console", "toggle": true} },
{
"keys": ["super+enter"],
"command": "set_layout",
"args":
{
"cols": [0.0, 1.0],
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten

This gist outlines how to resize a view when a keyboard appears using Auto Layout (there are a bunch of code samples out there that manually adjust the view's frame, but that's just so 2013). The method I outline below works universally on both iPhone and iPad, portrait and landscape, and is pretty darn simple.

Setting Up

The first thing to do is to define our containing view controller, the view, and the bottom constraint that we'll use to adjust its size.

Here's HeightAdjustingViewController.h. We don't need to expose any public properties, so it's pretty bare.