Skip to content

Instantly share code, notes, and snippets.

View roydondsouza's full-sized avatar

Roydon DSouza roydondsouza

View GitHub Profile
@roydondsouza
roydondsouza / keybase.md
Created April 23, 2020 19:05
Keybase proof

Keybase proof

I hereby claim:

  • I am roydondsouza on github.
  • I am roydondsouza (https://keybase.io/roydondsouza) on keybase.
  • I have a public key ASBp6aENl5We3jJdAOEXu4qp6vfm4VZRCE-yKn6hv9S6bAo

To claim this, I am signing this object:

@roydondsouza
roydondsouza / API.md
Created June 26, 2018 04:32 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@roydondsouza
roydondsouza / elasticsearch.md
Created September 1, 2017 05:13 — forked from nicolashery/elasticsearch.md
Elasticsearch: updating the mappings and settings of an existing index

Elasticsearch: updating the mappings and settings of an existing index

Note: This was written using elasticsearch 0.9.

Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:

$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
  "_id": 1,
@roydondsouza
roydondsouza / gist:294e4e79e550e998000f14ddcfe59dbd
Created May 29, 2017 20:14 — forked from jaydson/gist:1780598
How to detect a click event on a cross domain iframe
var myConfObj = {
iframeMouseOver : false
}
window.addEventListener('blur',function(){
if(myConfObj.iframeMouseOver){
console.log('Wow! Iframe Click!');
}
});
document.getElementById('YOUR_CONTAINER_ID').addEventListener('mouseover',function(){
@roydondsouza
roydondsouza / braintree.txt
Last active April 19, 2017 21:21
Braintree Responses (Sandbox)
Customer Create:
(Success):
{
"customer": {
"id": "38656872",
"merchantId": "5xtcjpc4szdqhp8c",
"firstName": "Roy",
"lastName": "Smith",
"company": null,
@roydondsouza
roydondsouza / gmail.js
Created March 15, 2017 13:17
Gmail JS - Experimental Draft
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://github.com/KartikTalwar/gmail.js/raw/master/src/gmail.js">
// {inject gmail.js} by copy pasting gmail.js contents or via url like jquery above
// var Gmail = {.....} // paste gmail.js code here
// start using!
// you can also pass in a reference to jQuery upon init - Gmail(localJQuery)
var gmail = Gmail();
@roydondsouza
roydondsouza / gist:7a6a5ffd28377aca64468e5d48fe9978
Created March 14, 2017 15:49 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@roydondsouza
roydondsouza / multer-to-s3.js
Created March 9, 2017 14:29 — forked from adon-at-work/multer-to-s3.js
Sample File Upload From Multer to S3
var AWS = require('aws-sdk'),
fs = require('fs');
// http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Credentials_from_Disk
AWS.config.loadFromPath('./aws-config.json');
// assume you already have the S3 Bucket created, and it is called ierg4210-shopxx-photos
var photoBucket = new AWS.S3({params: {Bucket: 'ierg4210-shopxx-photos'}});
function uploadToS3(file, destFileName, callback) {

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@roydondsouza
roydondsouza / sns-publish
Created February 4, 2017 19:42 — forked from jeremypruitt/sns-publish
AWS Lambda function to publish to SNS topic
console.log('Loading function');
var AWS = require('aws-sdk');
AWS.config.region = 'us-west-2';
exports.handler = function(event, context) {
console.log("\n\nLoading handler\n\n");
var sns = new AWS.SNS();
sns.publish({