Skip to content

Instantly share code, notes, and snippets.

const SENDGRID_API_KEY = 'INSERT API KEY HERE'
const MY_TEMPLATE_ID = 'INSERT TEMPLATE ID HERE'
var sendgrid = require('sendgrid')(process.env.SENDGRID_API_KEY)
// Note the html parameter - you must have this set or you'll get an error about having no
// body set
var email = new sendgrid.Email({
from: 'sentfrom@yourdomain.com',
to: 'my.user@theirdomain.com',
@ashokfernandez
ashokfernandez / deploy.sh
Created March 10, 2015 11:52
Build and tag docker repo for deployment
#!/bin/bash
# Builds and pushed docker image of a git repo, tagging the git repo and docker image with the
# same tag. Make sure you are logged into docker and that boot2docker is running if you're on
# OSX or Windows
# Check that a version tag was given
if [ $# -eq 0 ]
then
echo "No version tag supplied, please enter a version tag as the first parameter of this script"
@ashokfernandez
ashokfernandez / build-run-docker.sh
Last active August 29, 2015 14:16
Build and run a docker image, then open a bash shell inside the running container
#!/bin/bash
docker stop $(docker ps -a -q) # Stop and close any running docker containers
docker rm $(docker ps -a -q)
docker build -t myapp . # Build and run the container
docker run --name mydockerapp -d -p 80:80 myapp
docker exec -it mydockerapp bash # Open a bash terminal on the running container
@ashokfernandez
ashokfernandez / FizzBuzz.c
Created April 14, 2014 13:59
FizzBuzz Using C
#include <stdio.h>
#include <stdbool.h>
#define STARTING_NUMBER 1
#define ENDING_NUMBER 100
enum CASES { MULTIPLE_OF_THREE = 1, MULTIPLE_OF_FIVE, MULTIPLE_OF_BOTH };
/**
* Tests if 'number' is a multiple of 'multiple', returns TRUE or FALSE accoringly