This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import ComponentContainer from './ComponentContainer'; | |
class App extends Component { | |
render() { | |
let components = ['D1', 'D2', 'D3']; | |
return ( | |
<div> | |
<h2>Dynamic Components Loading</h2> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
// Event defines your lambda input and output data structure, | |
// and of course you can have different input and output data structure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
// InEvent defines your lambda input data structure, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
// Event defines your lambda input/output data structure, | |
type Event struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
// Event defines your lambda input/output data structure, | |
type Event struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Comment": "A step function to test some lambda functions in Go", | |
"StartAt": "Step1", | |
"States": { | |
"Step1": { | |
"Type": "Task", | |
"Resource": "arn:aws:lambda:ap-southeast-2:xyz:function:lambda-f1", | |
"Next": "Step2" | |
}, | |
"Step2": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "github.com/aws/aws-lambda-go/lambda" | |
type Event struct { | |
Payload string `json:"payload"` | |
} | |
func HandleRequest(e Event) (Event, error) { | |
return Event{"Hello World"}, nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :) | |
// Let say you can perform these 3 actions in parallel, then you can run them | |
// all at once and aggregate the result which is good | |
var p1 = addB(2, 3) | |
var p2 = addB(2, 3) | |
var p3 = addB(2, 3) | |
Promise.all([p1, p2, p3]).then(([r1, r2, r3]) => { | |
console.log(r1, r2, r3) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Async using call back | |
var addA = function (a, b, cb) { | |
setTimeout (() => { | |
cb(a + b); | |
}, 0); | |
}; | |
// How to use it :D | |
addA(2, 3, (result) => { | |
console.log(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Async using promise | |
var addB = function (a, b) { | |
return new Promise((resolve, reject) => { | |
setTimeout (() => { | |
resolve(a + b); | |
}, 0); | |
}); | |
}; | |
// How to use it :D |
OlderNewer