This file contains hidden or 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 | |
# Kill all running containers. | |
docker kill $(docker ps -q) | |
# Delete all stopped containers. | |
printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q) | |
# Delete all untagged images. |
This file contains hidden or 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 FluentPostgreSQL | |
import Vapor | |
public func configure(_ config: inout Config, _ env: inout Environment, _ services: inout Services) throws { | |
// (1) Standard PostgreSQL setup | |
try services.register(FluentPostgreSQLProvider()) | |
let pgURL = Environment.get("DATABASE_URL") ?? "postgres://vapor:[email protected]:5432/vapor" | |
let pgConfig = PostgreSQLDatabaseConfig(url: pgURL)! |
This file contains hidden or 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
class CollectionViewController: UIViewController { | |
... | |
func snapToCenter() { | |
let centerPoint = view.convertPoint(view.center, toView: collectionView) | |
guard let centerIndexPath = collectionView.indexPathForItemAtPoint(centerPoint) | |
collectionView.scrollToItemAtIndexPath(centerIndexPath, atScrollPosition: .CenteredHorizontally, animated: true) | |
} | |
... | |
} | |