-
Notifications
You must be signed in to change notification settings - Fork 0
/
scratch.lisp
63 lines (55 loc) · 2.14 KB
/
scratch.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(defun xxx (channel)
(let ((id-hash (make-hash-table :test 'equal)))
(find-docs 'list
(lambda (doc)
(when (string-equal (post-type doc) channel)
(let ((post (gethash (post-id doc) id-hash))
(duplicate nil))
(when post
(setf duplicate t))
(unless post
(setf (gethash (post-id doc) id-hash) doc))
duplicate)
))
(generic-post-collection))))
(defun yyy (channel)
(let ((id-hash (make-hash-table :test 'equal)))
(find-docs 'list
(lambda (doc)
(when (string-equal (post-type doc) channel)
doc
))
(generic-post-collection))))
(defun zzz (payload-source)
(find-docs 'list
(lambda (doc)
(when (string-equal (payload-source doc) payload-source)
doc
))
(generic-post-collection)))
(defun delete-webfantix-tweets ()
(find-docs 'list
(lambda (doc)
(when (string-equal (post-type doc) "Twitter")
(when (string-equal (get-val (channel-user doc) 'channel-user-name) "webfanatix")
(remove-doc doc)
(setf doc nil)
t)
))
(generic-post-collection)))
(defun delete-duplicate-posts (channel)
(let ((id-hash (make-hash-table :test 'equal)))
(find-docs 'list
(lambda (doc)
(when (string-equal (post-type doc) channel)
(let ((post (gethash (post-id doc) id-hash))
(duplicate nil))
(when post
(remove-doc doc)
(setf doc nil)
(setf duplicate t))
(unless post
(setf (gethash (post-id doc) id-hash) doc))
duplicate)
))
(generic-post-collection))))