Skip to content

Instantly share code, notes, and snippets.

View cadecairos's full-sized avatar

Christopher DeCairos cadecairos

View GitHub Profile
# A postgresql container to store all your dev dataz!
pg:
# cade/webmaker-postgres is a slightly customized version of the official Docker Hub postgres container
image: cade/webmaker-postgres
# Enable host networking for the container - effectively making th containers 'localhost' the same as the host
net: "host"
# Mounts the pg_data folder in this repo to the containers filesystem.
@cadecairos
cadecairos / docker-compose.yml
Last active November 19, 2015 22:18
Instant Webmaker API+ID+LOGINAPI services using Docker Compose
webmaker:
image: cade/webmaker-api:latest
env_file: compose.webmaker.env
net: "host"
id:
image: cade/webmaker-id:latest
env_file: compose.id.env
net: "host"
loginapi:
image: cade/legacy-webmaker-login:latest
@cadecairos
cadecairos / docs.md
Last active November 17, 2015 18:43
WIP tag route documentation for api.webmaker.org

GET /projects/featured-tags

Response:

// NOTE: tags ARE NOT stored or returned with a leading '#'
{
  "featured": [
    "tags", 
 "that", 
@cadecairos
cadecairos / Option1.md
Last active November 5, 2015 16:45
Several options for tag based endpoints.

We can roll the new featured tag[s] into /discover

Pros: No extra HTTP requests on the client

Cons: Kind weird, especially with pagination. Larger payload sizes.

GET /disover

{

Preparing import data

Tools used

Since projects take up about 750Mib of disk space, loading them all into a node process is not possible. Therefore, I broke the projects up into 50000 project chunks. You're probably also going to want to manuall increase the Heap size available to V8 using node --max_old_space_size=2000000

@cadecairos
cadecairos / reset_codes.sql
Last active October 16, 2015 16:06
Generate uuid v4 reset codes using a plpgsql function and a trigger
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE OR REPLACE FUNCTION generate_reset_code()
RETURNS TRIGGER AS $$
BEGIN
NEW.code = gen_random_uuid();
RETURN NEW;
END;
$$ language 'plpgsql';
@cadecairos
cadecairos / id-webmaker-org.er
Last active October 7, 2015 18:39
Entity-Relationship Diagrams for id.webmaker.org and login.webmaker.org, using http://hackage.haskell.org/package/erd
title {
label: "mozilla/id.webmaker.org ERD", size: "20"
}
[Clients]
*client_id
client_secret
allowed_grants
allowed_responses
redirect_url

Keybase proof

I hereby claim:

  • I am cadecairos on github.
  • I am cadecairos (https://keybase.io/cadecairos) on keybase.
  • I have a public key whose fingerprint is 99F9 2E19 A752 31D1 CEF5 C795 3758 CA9B 4018 940D

To claim this, I am signing this object:

@cadecairos
cadecairos / fix-inputs.css
Last active September 26, 2017 02:11
stylish stylesheet that fixes input elements in firefox when using a dark GTK theme
@namespace url(http://www.w3.org/1999/xhtml);
html input,
html textarea,
html select,
html button,
html input[type="reset"],
html input[type="button"],
html input[type="submit"],
html input[type="radio"],
var schema = Joi.array().items(
Joi.object().keys({
a: Joi.string().valid('1', '2', '3'),
b: Joi.string().valid('a', 'b', 'c'),
c: Joi.object().keys({
// Does this work?
// if not, how do I reference 'a' properly?
d: Joi.any().when('a', {
is: '1',