Let's say you want to host domains first.com
and second.com
.
Create folders for their files:
import LinkPresentation | |
import Combine | |
extension LPMetadataProvider { | |
func startFetchingMetadataPublisher(for url: URL) -> AnyPublisher<LPLinkMetadata?, Error> { | |
Future<LPLinkMetadata?, Error> { completion in | |
self.startFetchingMetadata(for: url) { meta, error in | |
guard let error = error else { | |
return completion(.success(meta)) | |
} |
#!/bin/bash | |
SPINE_VERSION="3.7.83" | |
ARCHS=("x86_64") | |
SDK_VERSION="10.14" | |
ROOT_DIR=$(pwd) | |
WORKER=$(getconf _NPROCESSORS_ONLN) | |
BUILD_DIR="build/macos/spine" | |
LOG_FILE="$ROOT_DIR/$BUILD_DIR/build.log" |
The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).
My take-aways are:
You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.
Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
{ | |
"friendmoji_url" : "https:\/\/e.mirror-ai.net\/fj\/en\/{face1}\/{version1}\/{face2}\/{version2}\/{emotion}.png", | |
"ok" : true, | |
"active_memojis" : [ | |
{ | |
"suggestions" : [ | |
"ice", | |
"olympics", | |
"optimism", | |
"quick", |
/// Translation of [Peter Norvig's spell checker](http://norvig.com/spell-correct.html) into Swift 3. | |
/// Sample input corpus [here](http://norvig.com/big.txt) | |
/// Swift 2 version: https://gist.github.com/airspeedswift/6d8c9d95f0d812f58be3 | |
import Foundation // purely for IO, most things done with Swift.String | |
/// Given a word, produce a set of possible alternatives with | |
/// letters transposed, deleted, replaced or rogue characters inserted | |
func edits(word: String) -> Set<String> { | |
if word.isEmpty { return [] } |
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}" | |
# This script loops through the frameworks embedded in the application and | |
# removes unused architectures. | |
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK | |
do | |
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable) | |
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME" | |
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH" |
let path = UIBezierPath() | |
let radius : CGFloat = 4 | |
let topRightStartAngle = -CGFloat(M_PI_2) | |
let topRightEndAngle : CGFloat = 0.0 | |
let bottomRightStartAngle : CGFloat = 0.0 | |
let bottomRightEndAngle : CGFloat = -(CGFloat(M_PI) * 3) / 2 | |
let bottomRightCenterPoint = CGPoint(x: CGRectGetWidth(self.bounds) - radius, y: CGRectGetHeight(self.bounds) - radius) |
#import <mach/mach_host.h> | |
int get_platform_memory_limit() | |
{ | |
mach_port_t host_port; | |
mach_msg_type_number_t host_size; | |
vm_size_t pagesize; | |
host_port = mach_host_self(); | |
host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); |