Skip to content

Instantly share code, notes, and snippets.

View Casxt's full-sized avatar
💭
I may be slow to respond.

Forer Casxt

💭
I may be slow to respond.
View GitHub Profile
@Casxt
Casxt / example.html
Created July 30, 2018 07:23 — forked from kylebarrow/example.html
Prevent links in standalone web apps opening Mobile Safari
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>
@Casxt
Casxt / SqlDealNull.go
Created July 17, 2018 17:32
[Golang] Use pointer to deal sql null value | 使用指针处理SQL NULL 值
var (
nullInt *int
nullTime *time.Time
nullString string
)
row := course.QueryRow("SELECT NULL,NULL,NULL FROM Table", LineID)
DBErr = row.Scan(&nullInt, &nullTime, &nullString);
if DBErr != nil {
return
@Casxt
Casxt / http.go
Last active July 11, 2018 06:59
[Golang]从req.RemoteAddr中提取IP || Match IP from RemoteAddr
func route(res http.ResponseWriter, req *http.Request) {
path := req.URL.Path
log.Println(req.RemoteAddr[0:strings.LastIndex(req.RemoteAddr, ":")], req.Method, path)
}
//OutPut: 2018/07/11 14:54:35 [::1] GET /favicon.ic
@Casxt
Casxt / pass_socket.py
Created August 1, 2017 10:37 — forked from josiahcarlson/pass_socket.py
An example of passing a socket between processes using Python's multiprocessing library
'''pass_socket.py
Written September 14, 2012
Released into the public domain.
Works on Python 2.6, 2.7, and may need minor changes for 3+.
'''
import multiprocessing