Skip to content

Instantly share code, notes, and snippets.

View tumata's full-sized avatar

Bertin Philippe tumata

  • Teladoc Health
  • Santa Barbara / USA / France
View GitHub Profile
@tumata
tumata / tableViewKeyboardHandling.m
Created February 28, 2019 22:29 — forked from TimMedcalf/tableViewKeyboardHandling.m
The easy & reliable way of handling UITableView insets when the keyboard is shown. This works unchanged no matter where the table view is on the screen (including dealing with orientation, hierarchy, container view controllers & all devices)
/*
One of the first things someone new to iOS Development finds is that dealing with the keyboard is trickier
than they think it should be. Simply changing the scrolling extents of a UITableView (or UIScrollView, or
UICollectionView) that is partially covered by they keyboard reveals a lot about the internals of how iOS
works and highlights various "gotchas" that need to be considered.
There are various ways to know that a keyboard has been shown - but observing some specific notifications
provides a reliable way to allow you to modify your views to deal with it.
@tumata
tumata / Crashlytics_JIRA_WebHook_AWS.js
Last active December 1, 2017 18:58
Crashlytics JIRA integration (custom Web Hook using AWS Lambda)
var http = require("https");
exports.handler = (event, context, callback) => {
// For the Crashlytics WebHook Verification, just return a 200
if (event['body-json']['event'] === 'verification') {
callback(null, 'success');
return;
}
@tumata
tumata / CGRectIntegralScaled.m
Created November 2, 2016 22:31 — forked from mpospese/CGRectIntegralScaled.m
Pixel aligns rectangles, taking the device's screen scale into account.
CGRect CGRectIntegralScaledEx(CGRect rect, CGFloat scale)
{
return CGRectMake(floorf(rect.origin.x * scale) / scale, floorf(rect.origin.y * scale) / scale, ceilf(rect.size.width * scale) / scale, ceilf(rect.size.height * scale) / scale);
}
CGRect CGRectIntegralScaled(CGRect rect)
{
return CGRectIntegralScaledEx(rect, [[UIScreen mainScreen] scale]);
}