This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Matrix | |
data Matrix : Nat -> Nat -> Type -> Type where | |
Matr : Vect m (Vect n a) -> Matrix n m a | |
(+) : Matrix n m a -> Vect n a -> Matrix n (m + 1) a | |
(+) (Matr rows) row = Matr (rows ++ [row]) | |
implicit vectVectToMatr : Vect m (Vect n a) -> Matrix n m a | |
vectVectToMatr = Matr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let if = macro { | |
rule { | |
($x:expr) { | |
$truebody | |
... | |
$truelast:expr | |
} else { | |
$falsebody | |
... | |
$falselast:expr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalaz._; import Scalaz._ | |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global | |
def getInteger(x: Int): OptionT[Future, Int] = 42.point[Future].liftM[OptionT] | |
def computeList(n: Int): OptionT[Future, List[Int]] = (1 to n).toList.traverseU(getInteger) | |
//if you need a Future[OptionT[List[Int]]] just use run | |
computeList(3).run // Some(List(1, 2, 3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.concurrent._ | |
import scala.concurrent.duration._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
def getInteger(x: Int) = Future.successful( | |
if (x == 11) None else Some(x)) | |
def sequence[T](l: Seq[Option[T]]): Option[List[T]] = l.foldRight(Some(Nil) : Option[List[T]]) { | |
(or, ox) => for (r <- or; x <- ox) yield (r :: x) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Messages { | |
type IString = I18nString[En with It] | |
val cart: IString = en"Shopping cart" | it"Carrello" | |
val login: IString = en"Login" | it"Accedi" | |
val betReplayedBy: IString = | |
en""" | |
Ticket replayed by {n, plural, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GITHUB_API=https://api.github.com | |
AUTH_TOKEN= # GITHUB API TOKEN HERE | |
REPO= # REPO NAME HERE | |
URL=${bamboo.buildResultsUrl} | |
SHA=${bamboo.repository.revision.number} | |
SUCCESS_DESCRIPTION="The Bamboo CI build passed" | |
FAILURE_DESCRIPTION="Build #${bamboo.buildNumber} failed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
API.cancelConsultation(consultation._id) | |
|> showHUDOnStart(status: "canceling consultation") | |
|> showHUDOnSuccessAndError | |
|> start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
statusBarBg.setTranslatesAutoresizingMaskIntoConstraints(false) | |
// set a background color for the status bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pod::Spec.new do |s| | |
s.name = "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. | |
DESC | |
s.homepage = "https://github.com/ReactiveCocoa/ReactiveCocoa" | |
s.license = "MIT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UIViewController+BackgroundStatusBar.swift | |
// hailadoc-ios | |
// | |
// Created by Gabriele Petronella on 7/16/15. | |
// Copyright (c) 2015 buildo. All rights reserved. | |
// | |
import Foundation | |
extension UIViewController { |