csrutil disable
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 | |
| import Gridicons | |
| import UIKit | |
| import WebKit | |
| class WebViewController: UIViewController { | |
| let webView = WKWebView() | |
| let progressView = WebProgressView() | |
| let toolbar = UIToolbar() | |
| let titleView = NavigationTitleView() |
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
| ''' | |
| Alex Walczak, 2017 | |
| Example of barrier implementation using TensorFlow shared variables | |
| across a multi-machine cluster. | |
| All workers synchronize on the barrier, copy global parameters to local versions, | |
| and increment the global parameter variable asynchronously. | |
| On each worker run: |
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
| extension KeyedDecodingContainer { | |
| func decode<T: Decodable, Inner: CodingKey>(_ type: T.Type, forKey key: KeyedDecodingContainer.Key, innerKey: Inner) throws -> [T] { | |
| var array = try nestedUnkeyedContainer(forKey: key) | |
| var items: [T] = [] | |
| while !array.isAtEnd { | |
| let container = try array.nestedContainer(keyedBy: Inner.self) | |
| let item = try container.decode(T.self, forKey: innerKey) | |
| items.append(item) | |
| } |
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 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"). | |
| # You may not use this file except in compliance with the License. | |
| # A copy of the License is located at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # or in the "license" file accompanying this file. This file is distributed | |
| # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
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
| class Solution: | |
| """ | |
| Solution to Leet Code problem 4Sum: https://leetcode.com/problems/4sum/ | |
| Runtime: 100 ms beats 93.4% of python3 submissions | |
| """ | |
| def fourSum(self, nums, target): | |
| """ | |
| :type nums: List[int] | |
| :type target: int | |
| :rtype: List[List[int]] |
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 tensorflow as tf | |
| def create_bad_dataset(create_batches=True): | |
| dataset = tf.data.Dataset.from_tensor_slices([1., 2., 0., 4., 8., 16.]) | |
| # Computing `tf.check_numerics(1. / 0.)` will raise an InvalidArgumentError. | |
| if create_batches: | |
| # Demonstrates that error handling works with map_and_batch | |
| dataset = dataset.apply(tf.contrib.data.map_and_batch( | |
| map_func=lambda x: tf.check_numerics(1. / x, 'error'), batch_size=2)) |
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
| // | |
| // AttributedString.swift | |
| // | |
| // Created by fm.tonakai on 2019/04/08. | |
| // | |
| import UIKit | |
| public struct AttributedString: ExpressibleByStringLiteral, ExpressibleByStringInterpolation, CustomStringConvertible { | |
| public struct StringInterpolation: StringInterpolationProtocol { |
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
| // Safely Modifying The View State (SwiftUI) | |
| // https://swiftui-lab.com | |
| // https://swiftui-lab.com/state-changes | |
| import SwiftUI | |
| struct CustomView: View { | |
| var body: some View { | |
| NavigationView { |