Table of Contents
This file contains hidden or 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
| NSScrollView* container = [[NSScrollView alloc] initWithFrame:CGRectMake(0, 0, 200, 100)]; | |
| container.hasVerticalScroller = YES; | |
| container.hasHorizontalScroller = YES; | |
| container.wantsLayer = YES; | |
| container.identifier = [@(LOGVIEW_OFFSET + i) stringValue]; | |
| NSClipView* clipview = [[NSClipView alloc] init]; | |
| clipview.autoresizesSubviews = YES; | |
| clipview.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; |
This file contains hidden or 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
| /* | |
| Copyright (C) 2016 Apple Inc. All Rights Reserved. | |
| See LICENSE.txt for this sample’s licensing information | |
| Abstract: | |
| `DirectoryMonitor` is used to monitor the contents of the provided directory by using a GCD dispatch source. | |
| */ | |
| import Foundation |
In this tutorial you'll learn how to run a Vapor server in a Docker container on Heroku.
Recently, Heroku added the ability to run Docker images on their Runtime. You can use this system instead of the traditional buildpack-based system for various reasons, mainly for having more control over the environment your server will run on.
To complete this tutorial, you'll need:
This file contains hidden or 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 protocol Diffable: Hashable { | |
| var primaryKeyValue: String { get } | |
| } | |
| /// A type-erased diffable value. | |
| /// The AnyDiffable type forwards diffing, equality comparisons and hashing operations to an underlying diffing value, | |
| /// hiding its specific underlying type. | |
| /// |
This file contains hidden or 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
| PLANTUML_JAR_URL = https://sourceforge.net/projects/plantuml/files/plantuml.jar/download | |
| DIAGRAMS_SRC := $(wildcard diagrams/*.plantuml) | |
| DIAGRAMS_PNG := $(addsuffix .png, $(basename $(DIAGRAMS_SRC))) | |
| DIAGRAMS_SVG := $(addsuffix .svg, $(basename $(DIAGRAMS_SRC))) | |
| # Default target first; build PNGs, probably what we want most of the time | |
| png: plantuml.jar $(DIAGRAMS_PNG) | |
| # SVG are nice-to-have but don't need to build by default | |
| svg: plantuml.jar $(DIAGRAMS_SVG) |
Software installation of my usual tools (via homebrew) and applications (via homebrew-cask) can be automated with homebrew-bundle.
-
Install homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -
Add bundle:
brew tap Homebrew/bundle
This file contains hidden or 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 Foundation | |
| let size = MemoryLayout<Int16>.stride | |
| let data = Data(bytes: [1, 0, 2, 0, 3, 0]) // little endian for 16-bit values | |
| let int16s = data.withUnsafeBytes { (bytes: UnsafePointer<Int16>) in | |
| Array(UnsafeBufferPointer(start: bytes, count: data.count / size)) | |
| } | |
| let length = data.count * MemoryLayout<Int16>.stride |