Skip to content

Instantly share code, notes, and snippets.

@demosifter
demosifter / install
Created October 10, 2016 17:04
shell command to install the sdk
curl -sSL https://static-sdk.redsift.io/install | bash
@demosifter
demosifter / create
Created October 10, 2016 18:25
shell command to create a new sift named counter
redsift create counter
@demosifter
demosifter / how-to-mail-filtering-1.js
Created October 10, 2016 19:12
filter out emails that were send by the user
const others = json.filter(j => j.user !== j['from'].email);
@demosifter
demosifter / how-to-mail-filtering-2.js
Created October 10, 2016 19:14
checking all places for the text
others.map(value => {
let text = value.textBody || value.strippedHtmlBody || '';
return text;
});
- 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()
// 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()
@demosifter
demosifter / how-to-dag-nodes-1.json
Last active October 11, 2016 15:09
Update our node's input in the sift.json
"nodes":[{
"#": "First Node",
"input": {
"bucket": "gmailEmails"
},
"implementation": {
"javascript": "server/node1.js"
},
"outputs": {
"output1": {}
@demosifter
demosifter / how-to-dag-outputs-1.json
Last active October 11, 2016 15:09
defining an "outputs" section in the sift.json
"outputs":{
"exports":{
"count" : {
"key$schema":"string"
}
}
}
@demosifter
demosifter / how-to-dag-nodes-2.json
Last active October 11, 2016 15:10
updating our node's "outputs" section
"nodes":[{
"#": "First Node",
"input": {
"bucket": "gmailEmails"
},
"implementation": {
"javascript": "server/node1.js"
},
"outputs": {
"count": {}
return {
key: value.id, // instead of 'word_count'
value: count
}