学习了一种很有意思的进制(姑且这么说吧...)转换方式。 原理就是利用键值对+循环遍历。
第一次遇见这个方法是在一本讲Python的书里面,(不记得什么名字了,以后翻出来在补上。) 当时颇不以为然,第二次见到才醒悟,觉得这是一个不错的方法。
代码
function convert(num) {| //: # Swift 3: CGD and URLSessionDataTask | |
| import Foundation | |
| import PlaygroundSupport | |
| //: ### Create background queue | |
| let queue = DispatchQueue.global(qos: .background) | |
| //: ### Computed variable | |
| var time:DispatchTime! { |
| // | |
| // ImageResizer.swift | |
| // | |
| // Created by Alex Seifert on 18/06/2016. | |
| // http://www.alexseifert.com | |
| // | |
| import Foundation | |
| import Cocoa |
| // (string, swift, bytes, data, buffer, cstring) | |
| print("--- using nulTerminated ---") | |
| let x : String = "hello" | |
| let buf = x.nulTerminatedUTF8 | |
| print(buf) | |
| print("\n--- using [UInt8] ---") | |
| let buf2 : [UInt8] = [UInt8](x.utf8) | |
| print(buf2) |
| protocol DragViewDelegate { | |
| var acceptedFileExtensions: [String] { get } | |
| func dragView(dragView: DragView, didDragFileWith URL: NSURL) | |
| } | |
| class DragView: NSView { | |
| required init?(coder: NSCoder) { | |
| super.init(coder: coder) | |
| registerForDraggedTypes([NSFilenamesPboardType, NSURLPboardType]) |
| #!/bin/bash | |
| ################################################################################ | |
| ### OpenCV2 Installation Script ### | |
| ################################################################################ | |
| # Source code at https://github.com/arthurbeggs/scripts # | |
| ################################################################################ | |
| # # | |
| # Feel free to copy and modify this file. Giving me credit for it is your # | |
| # choice, but please keep references to other people's work, which I don't # |
学习了一种很有意思的进制(姑且这么说吧...)转换方式。 原理就是利用键值对+循环遍历。
第一次遇见这个方法是在一本讲Python的书里面,(不记得什么名字了,以后翻出来在补上。) 当时颇不以为然,第二次见到才醒悟,觉得这是一个不错的方法。
代码
function convert(num) {| func makeGetCall() { | |
| // Set up the URL request | |
| let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1" | |
| guard let url = URL(string: todoEndpoint) else { | |
| print("Error: cannot create URL") | |
| return | |
| } | |
| let urlRequest = URLRequest(url: url) | |
| // set up the session |
| // Author: Mathias Soeholm | |
| // Date: 05/10/2016 | |
| // No license, do whatever you want with this script | |
| using UnityEngine; | |
| using UnityEngine.Serialization; | |
| [ExecuteInEditMode] | |
| public class TubeRenderer : MonoBehaviour | |
| { | |
| [SerializeField] Vector3[] _positions; |
File > New > Project...
Create a Package.swift file in your root project directory, add dependencies, then run swift package fetch on the command line in the same directory. We’re not going to run swift build because it will just complain.
| using UnityEngine; | |
| using System.Collections; | |
| public class FlyCamera : MonoBehaviour { | |
| /* | |
| Writen by Windexglow 11-13-10. Use it, edit it, steal it I don't care. | |
| Converted to C# 27-02-13 - no credit wanted. | |
| Simple flycam I made, since I couldn't find any others made public. | |
| Made simple to use (drag and drop, done) for regular keyboard layout |