Skip to content

Instantly share code, notes, and snippets.

View mjhea0's full-sized avatar

Michael Herman mjhea0

View GitHub Profile
<!DOCTYPE html>
<head>
<title>Example Checkout w/ Google Analytics Tracking</title>
</head>
<body>
<!-- Need this included just once on any page you're selling something. Best to probably globally include it. -->
<script type="text/javascript" src="https://www.simplegoods.co/assets/embed.js"></script>
<!-- You probably already have jQuery included in your site. Here for completeness -->

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

d1 = {'Name': 'John', 'Age': '25', 'DOB': None}
d2 = {'Name': 'ABC', 'Age': None, 'DOB': '10/20/1983'}
d2.update({key: value for key, value in d1.items() if value})
print(d2) # => {'DOB': '10/20/1983', 'Age': '25', 'Name': 'John'}

Installing Python on Mac OSX with Homebrew

Homebrew is a package manager for Mac OSX that allows easy management of Python and many other development tools. You must have Xcode installed before you install Homebrew. Then follow the instructions on the Homebrew homepage to install Homebrew.

Install Python

$ brew update
$ brew install python
import requests
import base64
import json
from apscheduler.schedulers.blocking import BlockingScheduler
from config import APP, KEY, PROCESS
#############
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
GRANT ALL ON SCHEMA public TO <USERNAME>;
GRANT ALL ON SCHEMA public TO public;
COMMENT ON SCHEMA public IS 'standard public schema';
@mjhea0
mjhea0 / Dockerfile
Last active August 29, 2015 14:07 — forked from yadutaf/Dockerfile
FROM ubuntu:14.04
MAINTAINER Jean-Tiare Le Bigot "jt@lebigot.net"
ENV DEBIAN_FRONTEND noninteractive
# Grab all dependencies
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install curl libx11-dev libxtst-dev libxcomposite-dev \
libxdamage-dev libxkbfile-dev python-all-dev \
  1. generate an empty migration
  2. move the migration from old_app to new_app
  3. edit the migration file to change all instances of old_app to new_app
  4. add a forward migration to rename the table from something to something_else
  5. add a backward migration to do the opposite
  6. move models.py from old_app to new_app
  7. apply the migration

With POST Tunneling, you are simply making a POST request act like a different type of request. Why is this neceesary? Because if you're using AJAX, most browsers only allow you to send GET or POST requests.

What needs to change?

  1. The headers sent with the request in the JavaScript file: headers: {'X_METHODOVERRIDE': 'DELETE'}
  2. Django middleware. So that the method is updated for requests that contain the X_METHODOVERRIDE header.

Source.