mongo shell
db.variousInstance.aggregate([
{
$match: {}
},
{
$sort: {createAt: -1},
},
{
| type ReadCacheProxy[Input, ViewModel any] struct { | |
| ReadCache func(input *Input) (output *ViewModel, err error) | |
| ReadDatabase func(input *Input) (output *ViewModel, err error) | |
| WriteCache func(output *ViewModel) error | |
| Key string | |
| Locks *sync.Map | |
| } |
| #!/bin/sh | |
| commit_msg_file=$1 | |
| commit_msg=$(cat "$commit_msg_file") | |
| date_regex="^[0-9]{4}-[0-9]{2}-[0-9]{2}" | |
| if ! echo "$commit_msg" | grep -qE "$date_regex"; then | |
| echo "Error: commit message must start with a date in YYYY-MM-DD format." | |
| exit 1 | |
| fi |
| from dataclasses import dataclass, field, ClassVar | |
| from typing import Callable, Union, Optional, Any | |
| from enum import Enum | |
| Pattern = Union[Enum, str, int] | |
| Message = Any | |
| MessageHandler = Callable[[Message], None] | |
| MessageDecorator = Callable[[MessageHandler], MessageHandler] |
mongo shell
db.variousInstance.aggregate([
{
$match: {}
},
{
$sort: {createAt: -1},
},
{
| // main.go | |
| package main | |
| type Duck interface { | |
| Quack() | |
| } | |
| type Cat struct { | |
| Name string | |
| } |
| function RabinKarpSet(string s[1~K], string patterns[1~N]) | |
| //用hash table or Cuckoo Filter 來儲存敏感詞彙相關資料 | |
| set hsSet := emptySet | |
| //前置處理 | |
| foreach p in patterns | |
| insert hash(p[1~M]) into hsSet | |
| hs := hash(s[1~M]) | |
| //匹配運算 |
| type T struct { | |
| } | |
| var p *T | |
| func New() *T { | |
| if p == nil { | |
| p = new(T) | |
| } | |
| return p |
| //問題1用到的struct | |
| type IssuesSearchResult struct { | |
| TotalCount int `json:"total_count"` | |
| //為什麼使用 struct pointer 作內嵌欄位 | |
| //不能直接定義為 | |
| //Items []Issue ? | |
| Items []*Issue | |
| } | |
| //問題1用到的struct |
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "sync" | |
| ) | |
| var mu sync.Mutex | |
| var count int |
| function Foo(){ | |
| this.testArr=[2,4]; | |
| }; | |
| Foo.prototype={ | |
| str:'test', | |
| num:1, | |
| arr:[1,2], | |
| obj:{a:2} | |
| }; |