Skip to content

Instantly share code, notes, and snippets.

@formspoint
formspoint / dynamoDBPagination.ts
Created May 26, 2018 23:40 — forked from mayank-kansal15/dynamoDBPagination.ts
This gist contain code to demonstrate how pagination can be done in DynamoDB.
function searchBlogByTitle(query: string, itemsPerPage: number, lastEvaluatedKey?: string): Promise<any> {
const FIXED_ID_FOR_SEARCH_GSI = "1233421345223";
let params: AWS.DynamoDB.DocumentClient.QueryInput = {
TableName: "Blog",
IndexName: "BlogSearch",
KeyConditionExpression: "fixedIdForSearchGSI = :pkv",
FilterExpression: "contains(titleInLowerCase, :titleV)",
ExpressionAttributeValues: {
":pkv": FIXED_ID_FOR_SEARCH_GSI,
":titleV": query.toLocaleLowerCase()
@formspoint
formspoint / DefaultComponent.js
Created May 25, 2018 21:05 — forked from loopmode/DefaultComponent.js
Safeguarding async chains in React
// we have an async "initialize" method that performs several calls consecutively.
// after each step in the async chain, we might have been unmounted already
// and performing any further calls becomes obsolete
class DefaultComponent extends React.Component {
// ...
componentDidMount() {
this._isMounted = true;
this.initialize();
}
componentWillUnmount() {
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<title>Big Nerd</title>
<header name = "Access-Control-Allow-Origin" value = "*" />
</head>
@formspoint
formspoint / nginx-ssl-config
Created June 26, 2017 02:35 — forked from apollolm/nginx-ssl-config
Nginx Configuration with multiple port apps on same domain, with SSL.
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_geoforce {
server 127.0.0.1:3000;
}
upstream app_pcodes{
server 127.0.0.1:3001;
}