Skip to content

Instantly share code, notes, and snippets.

Gabriele Petronella gabro

Block or report user

Report or block gabro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
gabro / 0_reuse_code.js
Created Jul 6, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
gabro / AssetPicker.swift
Created Nov 2, 2015
A block-based asset picker for videos, photos and files
View AssetPicker.swift
import Photos
import MobileCoreServices
class AssetPicker: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIDocumentPickerDelegate, UIDocumentMenuDelegate {
static let sharedInstance = AssetPicker()
private lazy var cameraPicker: UIImagePickerController = {
let cameraPicker = UIImagePickerController()
gabro / FreeConsultations.scala
Last active Sep 24, 2015
Learning the Free monad with cats
View FreeConsultations.scala
package project
import cats._
object Main extends App {
import Algebra._
import ConsultationOp._
val c = Consultation(_id = "123", title = "A consultation")
gabro / boom.scala
Last active Sep 4, 2015
Subtle scala quirk with implicit conversions
View boom.scala
@ "42".toInt
res0: Int = 42
@ implicit object Foo extends Function1[String, Int] {
def apply(s: String) = s.toInt
defined object Foo
@ "42”.toInt
// BOOM (infinite recursion)
gabro / modalValueProducer.swift
Last active Aug 29, 2015
UIViewController producing values. Example of editing a profile section with a modal interaction, which can produce a new Patient
View modalValueProducer.swift
// Create a ViewController automatically wrapped in a UINavigationController
// returns the viewController and a Signal<Patient, NoError>
let (profileVC, signal) = EditPersonalInfoViewController.wrappedInNavigationController(patient: patient)
// observe the signal. When a new Patient is produced, update the view
// dismiss the view controller whenever the signal is completed (i.e. modifications have been saved or interaction has been canceled)
signal.observe(next: reloadViewForPatient, completed: dismissViewController)
// let the game being
self.presentViewController(profileVC, animated: true, completion: nil)
gabro / uvc_swizzle.swift
Created Jul 17, 2015
Handle viewWillTransitionToSize across all `UIViewController`s
View uvc_swizzle.swift
// UIViewController+BackgroundStatusBar.swift
// hailadoc-ios
// Created by Gabriele Petronella on 7/16/15.
// Copyright (c) 2015 buildo. All rights reserved.
import Foundation
extension UIViewController {
gabro / ReactiveCocoa.podspec
Created Jul 10, 2015
ReactiveCocoa v3.0-beta.9 Podspec
View ReactiveCocoa.podspec do |s| = "ReactiveCocoa"
s.version = "3.0-beta.9"
s.summary = "A framework for composing and transforming streams of values"
s.description = <<-DESC
ReactiveCocoa (RAC) is an Objective-C framework for Functional Reactive Programming. It provides APIs for composing and transforming streams of values.
s.homepage = ""
s.license = "MIT"
View statusbar_snippet.swift
// let's create our status bar background view
let statusBar = UIView()
// set the navigation bar color to white (assuming `navController` is our `UINavigationController`)
navController.navigationBar.barTintColor = UIColor.whiteColor()
// turn off the autoresizing mask, since we're using autolayout
// set a background color for the status bar
View RAC-SVProgressHUD.swift
|> showHUDOnStart(status: "canceling consultation")
|> showHUDOnSuccessAndError
|> start()
gabro /
Last active Oct 22, 2015
Bambo <3 GitHub Status API
SUCCESS_DESCRIPTION="The Bamboo CI build passed"
FAILURE_DESCRIPTION="Build #${bamboo.buildNumber} failed"
You can’t perform that action at this time.