Skip to content

Instantly share code, notes, and snippets.

View igorleonovich's full-sized avatar
🥊
Stay hungry, stay foolish.

Igor Leonovich igorleonovich

🥊
Stay hungry, stay foolish.
View GitHub Profile
@rafaelaazevedo
rafaelaazevedo / docker-clean.sh
Last active August 23, 2023 13:51
Clean all docker images/containers/volumes script
#!/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.
@vzsg
vzsg / 1_configure.swift
Created December 8, 2018 09:23
Vapor 3 Sessions with PostgreSQL example
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:vapor@127.0.0.1:5432/vapor"
let pgConfig = PostgreSQLDatabaseConfig(url: pgURL)!
@benjaminsnorris
benjaminsnorris / CollectionViewController.swift
Created March 10, 2016 03:00
Snap to center collection view cell
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)
}
...
}