Skip to content

Instantly share code, notes, and snippets.

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