Skip to content

Instantly share code, notes, and snippets.

@demosifter
demosifter / how-to-mail-filtering-2.js
Created October 10, 2016 19:14
checking all places for the text
View how-to-mail-filtering-2.js
others.map(value => {
let text = value.textBody || value.strippedHtmlBody || '';
return text;
});
View frontend-structure
- package.json
- gulpfile.js
- bundle.config.js
- src/
- scripts
- controller.js
- email-client-controller.js
- view.js
- styles
- *.css / *.styl
@demosifter
demosifter / how-to-controller-1.js
Last active October 11, 2016 13:59
first overview of loadView()
View how-to-controller-1.js
// for more info: https://docs.redsift.com/docs/client-code-siftcontroller
loadView(state) {
console.log('counter: loadView', state);
// ...
switch (state.type) {
// ...
case 'summary':
return {
html: 'summary.html',
data: {} //this.getX()
View how-to-dag-2.json
"dag": {
...
"nodes":[{
"#": "First Node",
"input": {
"bucket": "gmailEmails"
},
"implementation": {
"javascript": "server/node1.js"
},
View how-to-node1-3a.js
return {
key: value.id, // instead of 'word_count'
value: count
}
@demosifter
demosifter / how-to-dag-3.json
Last active October 11, 2016 16:18
adding a second node and making first node emit to store
View how-to-dag-3.json
"nodes":[{
"#": "First Node",
"input": {
"bucket": "gmailEmails"
},
"implementation": {
"javascript": "server/node1.js"
},
"outputs": {
"messageCounts": {}
View how-to-node2-1.js
module.exports = function (got) {
const total = got.in.data.reduce((p, d) => p + parseInt(d.value), 0);
return {
key: 'word_count',
value: total
}
}
@demosifter
demosifter / how-to-dag-outputs-2.json
Created October 11, 2016 16:12
exporting to _email.tid
View how-to-dag-outputs-2.json
"outputs":{
"exports":{
"count" : {
"key$schema":"string"
},
"threads": {
"import": "_email.tid"
}
}
}
@demosifter
demosifter / how-to-dag-stores-1.json
Created October 11, 2016 16:24
implementing key hierarchy
View how-to-dag-stores-1.json
"stores":{
"messageCounts" : {
"key$schema":"string/string"
}
}
View how-to-node1-3b.js
return {
key: `${value.threadId}/${value.id}`, // instead of 'value.id
value: {
count: count,
date: value.date
}
}