Skip to content

Instantly share code, notes, and snippets.

View Bosn's full-sized avatar

Bosn Bosn

  • PingCAP
  • Peking, China
  • 03:19 (UTC +08:00)
View GitHub Profile
import Foundation
enum BoError: Error {
case CommonError
}
func fetchWorker() -> Result<Int, BoError> {
var result: Result<Int, BoError>!
let semaphore = DispatchSemaphore(value: 0)
URLSession.shared.dataTask(with: URL(string: "https://actin.tech/worker")!) { data, response, error in
@Bosn
Bosn / URLSession POST.swift
Created May 13, 2020 08:05 — forked from dmathewwws/URLSession POST.swift
URLSession POST request example
private static func createUserEventData(user:SKUser, eventType:SKEventType, sticker:Sticker?) {
// server endpoint
let endpoint = "https://app.stickerkit.io/userEvent/v1/\(user.projectID)"
guard let endpointUrl = URL(string: endpoint) else {
return nil
}
//Make JSON to send to send to server
@Bosn
Bosn / loading_mask.md
Last active October 16, 2018 01:58
Loading Mask
.loading-mask {
  position: absolute;
  top: calc(50% - 25px);
  left: calc(50% - 25px);
  z-index: 1000;
}

.loading-mask::before {
 content: '';