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 asyncio | |
import httpx | |
async def do_request(client: httpx.AsyncClient): | |
try: | |
await client.get( | |
url="https://google.com", | |
) |
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 UIKit | |
import ObjectMapper | |
import RealmSwift | |
class Example: Object, Mappable, Meta { | |
dynamic var id: Int = 0 | |
dynamic var title: String = "" | |
dynamic var author: String = "" | |
dynamic var genre: String = "" |
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
extension Dictionary where Value : Equatable { | |
func allKeysForValue(val : Value) -> [Key] { | |
return self.filter { $1 == val }.map { $0.0 } | |
} | |
} |
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
public extension dispatch_queue_t { | |
final func async(block: dispatch_block_t) { | |
dispatch_async(self, block) | |
} | |
final func async(group: dispatch_group_t, _ block: dispatch_block_t) { | |
dispatch_group_async(group, self, block) | |
} | |
final func sync(block: dispatch_block_t) { | |
dispatch_sync(self, block) | |
} |
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
function mkicns() { | |
if [[ -z "$@" ]]; then | |
echo "Input file missing" | |
else | |
filename=${1%.*} | |
mkdir $filename.iconset | |
sips -z 16 16 $1 --out $filename.iconset/icon_16x16.png | |
sips -z 32 32 $1 --out $filename.iconset/icon_16x16@2x.png | |
sips -z 32 32 $1 --out $filename.iconset/icon_32x32.png | |
sips -z 64 64 $1 --out $filename.iconset/icon_32x32@2x.png |
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
func delay(delay:Double, closure:()->()) { | |
dispatch_after( | |
dispatch_time( | |
DISPATCH_TIME_NOW, | |
Int64(delay * Double(NSEC_PER_SEC)) | |
), | |
dispatch_get_main_queue(), closure) | |
} |