Skip to content

Instantly share code, notes, and snippets.

@Dweez
Dweez / bullit_api.md
Created November 18, 2017 14:32
Bullit API

API Bullit

Jquery Ajax :

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "YOUR_BULLIT_URL",
  "method": "POST",
@Dweez
Dweez / dns-subdomain-gandi-mailgun.txt
Created October 16, 2015 11:41
Gandi subdomain DNS configuration for Mailgun validation
# Gandi subdomain DNS configuration for Mailgun validation
# - Add the SPF record as TXT and SPF
# - Suffix the DKIM record and `email` CNAME with the subdomain
# ex: `mg.domain.com`
mg 10800 IN CNAME mailgun.org.
@ 10800 IN SPF "v=spf1 include:mailgun.org ~all"
@ 10800 IN TXT "v=spf1 include:mailgun.org ~all"
mailo._domainkey.mg 10800 IN TXT "k=rsa; p=MIG...QAB"
email.mg 10800 IN CNAME mailgun.org.
@ 10800 IN MX 10 mxa.mailgun.org.
@Dweez
Dweez / created_at_to_datetime.py
Last active August 29, 2015 14:12
return datetime from Twitter created_at
from datetime import datetime
import time
def makeDate(created_at):
tst = time.strptime(created_at,'%a %b %d %H:%M:%S +0000 %Y')
dt = datetime.fromtimestamp(time.mktime(tst))
return dt
@Dweez
Dweez / sqla_to_json.py
Last active December 21, 2015 12:39
Converting SQLAlchemy objects to JSON
# stdlib
from json import dumps
def to_json(model):
""" Returns a JSON representation of an SQLAlchemy-backed object.
"""
json = {}
json['fields'] = {}
json['pk'] = getattr(model, 'id')