This file contains 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
// source: http://www.cnblogs.com/over140/p/4837652.html | |
class UILabelPadding : UILabel { | |
private var padding = UIEdgeInsets.zero | |
@IBInspectable | |
var paddingLeft: CGFloat { | |
get { return padding.left } | |
set { padding.left = newValue } |
This file contains 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
// | |
// Downloader.swift | |
// | |
// Created by Natata on 2017/9/15. | |
// Copyright © 2017 Natata. All rights reserved. | |
// | |
import Foundation | |
import Alamofire |
This file contains 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
func recoverFactory(f func()) func() { | |
rf := func() { | |
defer func() { | |
if r := recover(); r != nil { | |
fmt.Println("Recovered in f", r, "ker") | |
} | |
}() | |
f() | |
} |
This file contains 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 CMDeviceMotion { | |
func gaze(atOrientation orientation: UIInterfaceOrientation) -> SCNVector4 { | |
let attitude = self.attitude.quaternion | |
let aq = GLKQuaternionMake(Float(attitude.x), Float(attitude.y), Float(attitude.z), Float(attitude.w)) | |
let pi2 = Double.pi/2 | |
let final: SCNVector4 | |
switch UIApplication.shared.statusBarOrientation { |
This file contains 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
#!/bin/bash | |
# coding: utf-8 | |
# twitcasting_record.sh by Natata | |
# modified from showroom.sh by fcicq | |
# NOTE: need to install jq and livestreamer first | |
(jq --version 1>/dev/null 2>&1) || (echo 'install jq first'; exit) | |
(livestreamer --version 1>/dev/null 2>&1) || (echo 'install livestreamer first (run pip/pip3 install livestreamer)'; exit) | |
if [ -n "$1" ]; then |
This file contains 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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
NewerOlder