Skip to content

Instantly share code, notes, and snippets.

View kunal732's full-sized avatar

Kunal Batra kunal732

  • Amazon Web Services
  • United States
View GitHub Profile
@kunal732
kunal732 / one.php
Created July 29, 2013 20:39
Email DJ - One
<?php
require_once('config.php');
require_once "phar://iron_mq.phar";
require 'vendor/autoload.php';
//Get Post from SendGrid
$from = $_POST["from"];
$subject = $_POST["subject"];
@kunal732
kunal732 / two.php
Created July 29, 2013 20:43
Email DJ - Two
<?php
require_once "phar://iron_mq.phar";
require_once('config.php');
require 'vendor/autoload.php';
//setup the queue
$ironmq = new IronMQ(array(
"token" => $config['iron']['token'],
"project_id" => $config['iron']['id']
//convert body to image
$imageUrl= file_get_contents("http://api.img4me.com/?text=".$urlbody."&font=arial&fcolor=000000&size=10&bcolor=FFFFFF&type=png");
$imgName = $emailID.".png";
file_put_contents('img/'.$imgName, file_get_contents($imageUrl));
//html body to show
$htmlbody = "<img src=\"http://magicmail.io/img/".$imgName."\" />";
@kunal732
kunal732 / white.php
Last active December 20, 2015 16:39
<?php
$file = $_POST["filename"];
$im = imagecreatetruecolor(55, 30);
$white = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im,0,0,55,30,$white);
imagepng($im, 'img/'.$file);
imagedestroy($im);
@kunal732
kunal732 / ViewController.m
Last active December 21, 2015 17:09
Parse PFQueryTableViewController for IOS Storyboard
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (id)initWithCoder:(NSCoder *)aDecoder {
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
@interface ViewController : PFQueryTableViewController {
NSString *List;
NSDictionary *params;
NSInteger counter;
NSInteger refresh;
}
- (IBAction)sendList:(id)sender;
var sendgrid = require("sendgrid");
sendgrid.initialize("SendGrid_Auth_User", "SendGrid_Auth_token");
// Use Parse.Cloud.define to define as many cloud functions as you want.
// For example:
Parse.Cloud.define("hello", function(request, response) {
response.success("Hello world!");
});
Parse.Cloud.define("emailGrocery", function(request, response) {
@kunal732
kunal732 / gist:6339045
Created August 26, 2013 08:03
Calling Parse Cloud Module
NSDictionary *params = [NSDictionary dictionaryWithObject:List forKey:@"text"];
[PFCloud callFunctionInBackground:@"emailGrocery" withParameters:params block:^(id object, NSError *error){} ];
@kunal732
kunal732 / Objective-C Library
Last active December 27, 2015 03:59
send email with sendgrid-obj library
//create Email Object
sendgrid *msg = [sendgrid user:@"ApiUser" andPass:@"ApiKey"];
//set parameters
msg.subject = @"email subject";
msg.tolist = @[@"foo@bar.com", @"foo2@bar.com"];
msg.from = @"originalfoo@bar.com";
msg.text = @"hello world";
msg.html = @"<html><body><h1>hello world</h1></body></html>";
package main
import (
"fmt"
"net/http"
"log"
"github.com/sendgrid/sendgrid-go"
"regexp"
)