Skip to content

Instantly share code, notes, and snippets.

@demosifter
demosifter / how-to-dag-1.1.json
Created Jun 1, 2018
"inputs" section of the "dag" in the sift.json
View how-to-dag-1.1.json
"emails":{
"gmailEmails":{
"filter":{
"conditions":[{
"date": "between now and 1 week before now"
}]
},
"wants": [
"archive",
"headers",
View mini-elastic-search.go
func Compute(req sandboxrpc.ComputeRequest) ([]sandboxrpc.ComputeResponse, error) {
inData := req.In.Data
if len(inData) != 1 {
return nil, fmt.Errorf("empty input")
}
var resp []sandboxrpc.ComputeResponse
v := inData[0]
idx, err := utils.OpenIndex(true)
if err != nil {
View mini-elastic-load.go
func Compute(req sandboxrpc.ComputeRequest) ([]sandboxrpc.ComputeResponse, error) {
idx, err := utils.OpenIndex(false)
if err != nil {
return nil, errors.New("Something went wrong while creating the index: " + err.Error())
}
defer idx.Close()
datums, err := fetchMajesticCSV()
if err != nil {
return nil, err
View mini-elastic-dag.json
"dag": {
"inputs":{
"rpc":{
"search":{
"methods": ["GET"],
"path": "/_search",
"CORS":{}
}
}
},
View rpc-edig-dag-extract.json
"dag": {
"inputs":{
"rpc":{
"simple_rpc":{
"methods": ["GET"],
"path": "/edig/txt/*",
"CORS":{}
}
}
},
View rpc-edig-simple.js
const dns = require('dns');
const pify = require('pify');
//...
module.exports = function (got) {
const inData = got.in.data;
console.log('edig: simple.js: data received:', inData);
return inData.map(d => {
View rpc-simple.js
const newResponse = (status_code, header, body) => {
return { status_code, header,
body: Buffer.from(JSON.stringify(body) || '').toString('base64')
}
}
module.exports = function (got) {
const inData = got.in.data;
console.log('edig: simple.js: data received:', inData);
View rpc-dag-extract.json
{
"dag": {
"inputs": {
"rpc": {
"simple_rpc": {
"methods": ["GET"],
"path": "/simple",
"CORS": {}
}
}
View how-to-email-client-controller.js
loadThreadListView (listInfo) {
console.log('counter: loadThreadListView: ', listInfo);
if (listInfo) {
return {
template: '001_list_common_txt',
value: {
color: '#ffffff',
backgroundColor: '#e11010',
subtitle: listInfo + ' words'
}
View how-to-summary-1.html
<div class="column">
<p>I'm a Sift!</p>
<p id='number'>0</p>
</div>