Skip to content

Instantly share code, notes, and snippets.

View danamajid's full-sized avatar

Dana Majid danamajid

View GitHub Profile
@danamajid
danamajid / dropdown-directive
Created November 7, 2014 18:17
Simple Dropdown Directive AngularJS
app.directive('hasDropdown', function ($window, $timeout) {
return {
restrict: 'A',
replace: false,
link: function (scope, elm, attrs) {
elm.bind("click", open);
function open(e) {
elm[0].classList.add("open");
$timeout(function () {
const AWS = require('aws-sdk');
AWS.config.update({region: 'us-east-1'});
const dynamoDb = new AWS.DynamoDB.DocumentClient({ api_version: '2012-08-10' });
const TABLE = 'single-table-design';
const GSI1 = 'gsi1';
const GSI1PK = `${GSI1}pk`;
const GSI1SK = `${GSI1}sk`;
const GSI2 = 'gsi2';
const GSI2PK = `${GSI2}pk`;
@danamajid
danamajid / nosql-done-right-with-dynamodb.js
Created March 12, 2019 17:28
NoSQL Design for DynamoDB
// See: https://www.youtube.com/watch?v=HaEPXoXVf2k
const AWS = require('aws-sdk');
AWS.config.update({region: 'us-east-1'});
const dynamoDb = new AWS.DynamoDB.DocumentClient({ api_version: '2012-08-10' });
const TABLE = 'single-table-design';
const GSI1 = 'gsi1';
const GSI1PK = `${GSI1}pk`;
const GSI1SK = `${GSI1}sk`;