lishuhao / blog Goto Github PK
View Code? Open in Web Editor NEW博客
博客
sy_flutter_alipay这个插件,iOS支付宝支付接受不到回调,大佬看看怎么解决啊
When you create a fork of a repository (here are some instructions) you only have the versions of the files that are in the repository at that time. So if there are any changes in the original repository you may find that your version (your fork) is out of sync.
This can lead to problems when you try to create a pull request.
While GitHub has instructions for merging an upstream repository into your fork they require you to have git installed on your local machine.
Fortunately, when Kirstie reached out to the cool kids from the Mozilla Science Working Open Workshop they gave her the answer. And it turns out there was an answer on the interwebs already: you can update your fork in the browser by following the easy steps laid out in this Stack Overflow answer.
The Stack Overflow link has pictures which are really helpful, but briefly, here's what you do:
And now you're ready to continue working on your fork 😃 💥 🎉
Well done!
Golang json unmarshal time的格式是RFC3399:2019-04-11T11:41:50.723815+08:00
。
但是有些客户端不支持RFC3399,2019-04-11 11:41:50
这样的时间格式更为通用
其实Golang标准库time.Time 中也是实现了json.Marshaler 、json.Unmarshaler这两个接口
我们需要参考time.Time的这两个方法自定义一个数据类型: type DateTime time.Time
DateTime也需实现以上两个接口。
之后在需要time.Time 的地方改用Datetime
package utils
import "time"
const (
DatetimeFormat = "2006-01-02 15:04:05"
)
type DateTime time.Time
func (t DateTime)MarshalJSON()([]byte,error){
b := make([]byte, 0, len(DatetimeFormat)+2)
b = append(b, '"')
b = time.Time(t).AppendFormat(b, DatetimeFormat)
b = append(b, '"')
return b, nil
}
func (t *DateTime)UnmarshalJSON(data []byte)error{
if string(data) == "null" {
return nil
}
now, err := time.Parse(`"`+DatetimeFormat+`"`, string(data))
*t = DateTime(now)
return err
}
func (t DateTime) String() string {
return time.Time(t).Format(DatetimeFormat)
}
type JsonBody struct {
Created DateTime
}
func TestDateTime(t *testing.T) {
jsonBody:=JsonBody{
Created:DateTime(time.Now()),
}
b,_:=json.Marshal(jsonBody)
fmt.Println("encoded:",string(b))
//output encoded: {"Created":"2019-04-11 12:52:00"}
json.Unmarshal(b,jsonBody)
fmt.Printf("%+v",jsonBody)
//output {Created:2019-04-11 12:52:00}
}
git checkout --orphan latest_branch
git add -A
git commit -m "..."
git branch -D master
git branch -m master
git push -f origin master
numbers := make(int[],len,cap)
注意: JSON numbers <=> Go float64
bool, for JSON booleans
float64, for JSON numbers
string, for JSON strings
[]interface{}, for JSON arrays
map[string]interface{}, for JSON objects
nil for JSON null
ssh 远程登录服务器:ssh username@ip:port
会提示输入密码,比较麻烦
以下尝试用 ssh key 登录服务器,不需要输入密码
ssh key 一般是存储在 ~/.ssh 目录
如果没有生成过 ssh key 可以用命令:ssh-keygen -t rsa
生成 key。
ssh-keygen 文档
ssh username@ip:port
如果没有问题的话执行该命令就不需要密码了要记住 IP 也是挺麻烦的
可以为ssh username@ip:port
设置别名
<?php
//PHP
var_dump(0 == 'all');
//>> true
var_dump('0' == 'all');
//>> false
//⚠️Never cast an unknown fraction to integer
var_dump(intval(0.58 * 100));
//>> int(57)
//the internal representation will be something like 7.9999999999999991118....
var_dump(floor((0.1 + 0.7) * 10));
//>> double(7)
//⚠️不要直接比较浮点数是否相等
var_dump((0.1 + 0.7) == 0.8);
//>> bool(false)
//The key can either be an integer or a string.
//Strings containing valid integers will be cast to the integer type
//⚠️不要用浮点数做key
var_dump([
1 => "a",
"1" => "b",
1.5 => "c",
true => "d",
]);
//array(1) {
// [1] =>
// string(1) "d"
//}
//As all the keys in the above example are cast to 1,
// the value will be overwritten on every new element
// and the last assigned value "d" is the only one left over.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.