Skip to content

Instantly share code, notes, and snippets.

View thimes's full-sized avatar

Travis Himes thimes

View GitHub Profile
// MARK: - Helper Functions
extension NotificationService {
/// Use this function to download an image and present it in a notification
///
/// - Parameters:
/// - url: the url of the picture
/// - completion: return the image in the form of UNNotificationAttachment to be added to the bestAttemptContent attachments eventually
private func downloadImageFrom(url: URL, with completionHandler: @escaping (UNNotificationAttachment?) -> Void) {
let task = URLSession.shared.downloadTask(with: url) { (downloadedUrl, response, error) in
@esson
esson / Format JSON Bookmarklet
Created October 30, 2014 12:44
Bookmarklet that formats the JSON content on a page.
javascript:document.write('<pre>'+JSON.stringify(JSON.parse(document.body.textContent),null,'\t')+'</pre>')
@frankiesardo
frankiesardo / QuickReturn.java
Last active December 14, 2015 22:49
A refactored version of LarsWerkman's QuickReturnListView. It should provide an easier to use API and an easier to understand library.
public class QuickReturn {
private final static int ANIMATION_DURATION_MILLIS = 250;
private final ListView listView;
private final View quickReturnView;
private final View headerPlaceholder;
private int itemCount;
private int itemOffsetY[];