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 myInterval(interval: NSTimeInterval) -> Observable<Int> { | |
return Observable.create { observer in | |
print("Subscribed") | |
let queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) | |
let timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue) | |
var next = 0 | |
dispatch_source_set_timer(timer, 0, UInt64(interval * Double(NSEC_PER_SEC)), 0) |
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
Started ---- | |
Subscribed | |
Subscribed | |
First 0 | |
Second 0 | |
First 1 | |
Second 1 | |
First 2 | |
Second 2 | |
First 3 |
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
application: your app id | |
service: default | |
version: 1 | |
runtime: go | |
api_version: go1 | |
default_expiration: "1d" | |
instance_class: F1 | |
env_variables: | |
MY_VAR: 'my value' |
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
. | |
├── readme.md | |
├── config.toml | |
└── v1 | |
├── app | |
│ ├── app-engine.go | |
│ ├── app.go | |
│ ├── app.yaml | |
│ └── queue.yaml | |
├── app-standalone.go |
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
service cloud.firestore { | |
match /databases/{database}/documents { | |
function isOwn() { | |
return request.resource.userId == request.auth.uid; | |
} | |
function hasTimestamp() { | |
return request.resource.data.timestamp == request.time; | |
} | |
function isCalm() { | |
return request.time > resource.data.timestamp + duration.value(5, 's'); |
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
WITH start AS ( | |
SELECT | |
user_pseudo_id, | |
EXTRACT(DATE FROM TIMESTAMP_MICROS(event_timestamp)) AS start_date | |
FROM | |
`your.database.events_*` | |
WHERE | |
_TABLE_SUFFIX BETWEEN FORMAT_DATE("%Y%m%d", DATE_SUB(DATE_TRUNC(CURRENT_DATE(), WEEK), INTERVAL 5 WEEK)) AND FORMAT_DATE("%Y%m%d", DATE_SUB(DATE_TRUNC(CURRENT_DATE(), WEEK), INTERVAL 1 DAY)) | |
AND event_name = "your event name" | |
AND EXTRACT(DATE FROM TIMESTAMP_MICROS(event_timestamp)) BETWEEN DATE_SUB(DATE_TRUNC(CURRENT_DATE(), WEEK), INTERVAL 5 WEEK) AND DATE_SUB(DATE_TRUNC(CURRENT_DATE(), WEEK), INTERVAL 1 DAY) |
OlderNewer