学习了一种很有意思的进制(姑且这么说吧...)转换方式。 原理就是利用键值对+循环遍历。
第一次遇见这个方法是在一本讲Python的书里面,(不记得什么名字了,以后翻出来在补上。) 当时颇不以为然,第二次见到才醒悟,觉得这是一个不错的方法。
代码
function convert(num) {
// 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; |
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 |
学习了一种很有意思的进制(姑且这么说吧...)转换方式。 原理就是利用键值对+循环遍历。
第一次遇见这个方法是在一本讲Python的书里面,(不记得什么名字了,以后翻出来在补上。) 当时颇不以为然,第二次见到才醒悟,觉得这是一个不错的方法。
代码
function convert(num) {
#!/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 # |
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]) |
// (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) |
// | |
// ImageResizer.swift | |
// | |
// Created by Alex Seifert on 18/06/2016. | |
// http://www.alexseifert.com | |
// | |
import Foundation | |
import Cocoa |
//: # Swift 3: CGD and URLSessionDataTask | |
import Foundation | |
import PlaygroundSupport | |
//: ### Create background queue | |
let queue = DispatchQueue.global(qos: .background) | |
//: ### Computed variable | |
var time:DispatchTime! { |
import Image | |
import sys | |
import glob | |
import ImageOps | |
# Trim all png images with white background in a folder | |
# Usage "python PNGWhiteTrim.py ../someFolder" | |
try: | |
folderName = sys.argv[1] |
I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).
Use ssh keys and define host aliases in ssh config file (each alias for an account).