Skip to content

Instantly share code, notes, and snippets.

View mchavezi's full-sized avatar
🎯
Focusing

Michael A Chavez mchavezi

🎯
Focusing
View GitHub Profile
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

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

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")
version: '2'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
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
@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

@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 / 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 / mongolab import command
Created December 30, 2015 01:43
command to import json file into mongolab database collection.
mongoimport -h ds037155.mongolab.com:37155 -d <databasename> -c <collectionname> -u <username> -p <password> --file <nameofjsonfile.json> --jsonArray
@mchavezi
mchavezi / gist:b32174eecc9ec82ef24f
Created November 21, 2015 04:08 — forked from trevorgerhardt/gist:40e944e63dee3ee1779f
Script for Macs when file limit is hit when building large projects with component
echo 'kern.maxfiles=20480' | sudo tee -a /etc/sysctl.conf
echo 'limit maxfiles 8192 20480\nlimit maxproc 1000 2000' | sudo tee -a /etc/launchd.conf
echo 'ulimit -n 4096' | sudo tee -a /etc/profile