Skip to content

Instantly share code, notes, and snippets.

View mchavezi's full-sized avatar
🎯
Focusing

Michael A Chavez mchavezi

🎯
Focusing
View GitHub Profile
@mchavezi
mchavezi / custom-get-template-part.php
Last active July 14, 2017 18:07
An alternative to the native WP function `get_template_part`
/**
* Theme View
*
* Include a file and(optionally) pass arguments to it.
*
* @param string $file The file path, relative to theme root
* @param array $args The arguments to pass to this file. Optional.
* Default empty array.
*
* @return object Use render() method to display the content.
@mchavezi
mchavezi / gist:6cc3e0140c40a7a96bbeee7752b8fb68
Created January 27, 2018 08:10
THE EDUCATRON OF A COMPUTER Grace Murray Hopper
THE EDUCATRON OF A COMPUTER
Grace Murray Hopper
Remington Rand Corp.
While the materialization is new, the idea
of mechanizing mathematical thinking is not new.
Its lineage starts with the abacus and descends
through Pascal,Leibnit% and Babbage. Fore
immediately, the ideas here presented originate
from Professor Howard K. Aiken of Harvard
University, Dr. John W. Nauehly of EckertHauchly
@mchavezi
mchavezi / README-Template.md
Created June 2, 2018 20:28 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

import * as GoogleSpreadsheet from 'google-spreadsheet';
import * as async from 'async';
import * as Promise from 'bluebird';
import Sheet from "../models/sheets"
var creds = require('../client-key.json');
class SheetsControllers {
/**
* Get all sheets
version: '2'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
Inline-style:
![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
Inline-style:
![alt text](https://spacerocketphx2.s3.amazonaws.com/uploads/portfolio-thumnail/default/plos/PLOS-thumb.jpg "Logo Title Text 1")

Consider how a user who pays the invoice logs in, would he/she log into their subdomain or would they log in the public site? Ideally they would be able to only log into the public site with same credentials as the subdomain site to pay invoice.

Option 1

(not possible)

Registering an account creates an org and subscriber in the public schema and creates a user in the org's prefixed schema, where subscriber belongs to org and user.

Not possible because can't have dynamic prefixed migrations with each user created.

Option 2

defmodule MyApp.Registration do
@moduledoc """
The Registration context.
"""
alias Ecto.Multi
alias MyApp.Repo
alias MyApp.Subdomain.Accounts
alias MyApp.Orgs
alias MyApp.Accounts.User
alias MyApp.Orgs.Org
defmodule MyApp.Registration do
@moduledoc """
The Registration context.
"""
alias MyApp.Subdomain.Accounts
alias MyApp.Orgs
def create(attrs) do
case Orgs.register_org(attrs) do
{:ok, org} ->
defmodule MyApp.Registration do
@moduledoc """
The Registration context.
"""
alias MyApp.Subdomain.Accounts
alias MyApp.Orgs
alias MyApp.Tenants.Tenant
def create(attrs) do
case Orgs.register_org(attrs) do