Skip to content

Instantly share code, notes, and snippets.

Avatar

Siavash siavashalipour

View GitHub Profile
@siavashalipour
siavashalipour / UIViewCropped.swift
Created Sep 30, 2019
Swift crop a whole inside Blurred UIView
View UIViewCropped.swift
func createOverlay(frame: CGRect,
xOffset: CGFloat,
yOffset: CGFloat,
radius: CGFloat) -> UIView {
// Step 1
// let overlayView = UIView(frame: frame)
// overlayView.backgroundColor = UIColor.black.withAlphaComponent(0.6)
let blur = UIBlurEffect(style: .regular)
let blurViewTop = UIVisualEffectView(effect: blur)
blurViewTop.frame = view.bounds//CGRect(x: 0, y: 0, width: view.bounds.width, height: (view.bounds.height / 2) - 64)
@siavashalipour
siavashalipour / Application1.swift
Created Apr 10, 2018
ServerSideSwift - First part of Application.swift
View Application1.swift
func postInit() throws {
// Endpoints
initializeHealthRoutes(app: self)
let dbServiceCollection = dbService.getCollection()
// register
router.all("/register", middleware: BodyParser())
router.post("/register") { request, response, next in
guard let parsedBody = request.body else {
next()
@siavashalipour
siavashalipour / MongoDataBaseService.swift
Created Apr 10, 2018
ServerSideSwift - MongoDataBaseService
View MongoDataBaseService.swift
//
// MongoDBService.swift
// UserAPI
//
// Created by Siavash on 9/4/18.
//
import MongoKitten
struct MongoDataBaseService {
@siavashalipour
siavashalipour / Package.swift
Created Apr 10, 2018
ServerSideSwift - Package.swift file
View Package.swift
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "UserAPI",
dependencies: [
.package(url: "https://github.com/IBM-Swift/Kitura.git", .upToNextMinor(from: "2.2.0")),
.package(url: "https://github.com/IBM-Swift/HeliumLogger.git", .upToNextMinor(from: "1.7.1")),
.package(url: "https://github.com/IBM-Swift/CloudEnvironment.git", from: "6.1.0"),
.package(url: "https://github.com/RuntimeTools/SwiftMetrics.git", from: "2.0.0"),
@siavashalipour
siavashalipour / main.swift
Created Nov 18, 2016
End-to-end Swift Solution with IBM Bluemix Part one - 3
View main.swift
import Foundation
import Kitura
import LoggerAPI
import HeliumLogger
import CloudFoundryEnv
import CloudFoundryDeploymentTracker
do {
 // HeliumLogger disables all buffering on stdout
 HeliumLogger.use(LoggerMessageType.info)
 let controller = try Controller()
@siavashalipour
siavashalipour / Controller.swift
Created Nov 18, 2016
End-to-end Swift Solution with IBM Bluemix Part one - 2
View Controller.swift
//
// Controller.swift
// Microservice1
//
// Created by Siavash on 26/9/16.
//
//
import Foundation
import Kitura
import SwiftyJSON
@siavashalipour
siavashalipour / package.swift
Created Nov 18, 2016
End-to-end Swift Solution with IBM Bluemix Part one - 1
View package.swift
import PackageDescription
let package = Package(
name: “Microservice1”,
targets: [
Target(name: “Microservice1”, dependencies: [])
],
dependencies: [
.Package(url: “https://github.com/IBM-Swift/Kitura.git", majorVersion: 1, minor: 0),
.Package(url: “https://github.com/IBM-Swift/HeliumLogger.git", majorVersion: 1, minor: 0),
.Package(url: “https://github.com/IBM-Swift/Swift-cfenv.git", majorVersion: 1, minor: 7),
@siavashalipour
siavashalipour / makefile
Created Nov 18, 2016
End-to-end Swift Solution with IBM Bluemix Part two - 1
View makefile
# Copyright IBM Corporation 2016
#
# Licensed under the Apache License, Version 2.0 (the “License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS,
@siavashalipour
siavashalipour / Controller.swift
Last active Nov 18, 2016
End-to-end Swift Solution with IBM Bluemix Part three - 2
View Controller.swift
//
// Controller.swift
// Microservice2
//
// Created by Siavash on 26/9/16.
//
//
import Foundation
import Kitura
import SwiftyJSON
@siavashalipour
siavashalipour / package.swift
Created Nov 18, 2016
End-to-end Swift Solution with IBM Bluemix Part three - 1
View package.swift
import PackageDescription
let package = Package(
 name: “Microservice2”,
 targets: [
 Target(name: “Microservice2”, dependencies: [])
 ],
 dependencies: [
 .Package(url: “https://github.com/IBM-Swift/Kitura.git", majorVersion: 1, minor: 0),
 .Package(url: “https://github.com/IBM-Swift/HeliumLogger.git", majorVersion: 1, minor: 0),
  .Package(url: “https://github.com/IBM-Swift/Swift-cfenv.git", majorVersion: 1, minor: 7),
You can’t perform that action at this time.