Skip to content

Instantly share code, notes, and snippets.

View kavirajk's full-sized avatar
😎
Talk distributed systems to me!!

Kaviraj Kanagaraj kavirajk

😎
Talk distributed systems to me!!
View GitHub Profile
@kavirajk
kavirajk / emails.go
Last active July 15, 2016 14:13
Send Email (can be mocked)
package email
import (
"bytes"
"html/template"
"os"
"gopkg.in/gomail.v2"
)
@kavirajk
kavirajk / emails.go
Last active July 15, 2016 14:23
Send Email (cannot be mocked)
package email
import (
"bytes"
"html/template"
"os"
"gopkg.in/gomail.v2"
)
@kavirajk
kavirajk / gorm_joins.go
Created April 17, 2016 18:55
Understanding Joins in gorm
package main
import (
"fmt"
"log"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)
@kavirajk
kavirajk / python_getter_setter.py
Last active December 6, 2015 18:13
Simple python getter and setter example
class EmailField(object):
def __init__(self, email=None):
self.email = email
def __set__(self, email):
self.email = email
def __get__(self, email):
return self.email
@kavirajk
kavirajk / 0_reuse_code.js
Created November 2, 2015 03:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kavirajk
kavirajk / simple_django_model.py
Last active December 6, 2015 19:15
Models and python object difference
from django.db import models
class User(models.Model):
email = models.EmailField()
obj = User(email='kavirajkanagaraj@gmail.com')
print(User.email)
# output: AttributeError: type object 'User' has no attribute 'email'
print(obj.email)