Skip to content

Instantly share code, notes, and snippets.

View kissmygritts's full-sized avatar
🚀

Mitchell Gritts kissmygritts

🚀
  • Reno, NV
View GitHub Profile
@kissmygritts
kissmygritts / ColumnSet-columns.js
Created September 13, 2017 01:12
cool little function that I accidentally stumbled on to return an array of ColumnSets columns names. Completely useless, the nested maps might be useless too.
columns = ctx.map(m => m.cs().columns.map(c => c.name))
@kissmygritts
kissmygritts / QueryFile.js
Created September 6, 2017 19:03
how to access the QueryFile from a repo/sql for testing formatting.
const promise = require('bluebird')
const _ = require('lodash')
const argv = require('minimist')(process.argv.slice(2))
const config = require('../config/database.json')[argv.e]
const options = { promiseLib: promise }
const pgp = require('pg-promise')(options)
const db = pgp(config)
const sql = require('../sql')
module.exports = {
[
{
"id": 1,
"leads": [
{
"id": 1,
"name": "Mike Cox",
"type": "lead",
"proj_name": "Proj 1"
},
@kissmygritts
kissmygritts / projects-self-join.sql
Created August 26, 2017 01:39
testing self join
CREATE TABLE projs (
id serial PRIMARY KEY,
parent_id integer,
type text,
proj_name text,
proj_desc text,
proj_loc text,
proj_start date,
proj_duration integer,
attributes jsonb,
@kissmygritts
kissmygritts / project-seeds.sql
Created August 26, 2017 01:37
project test seeds
INSERT INTO projects
(type, proj_name, proj_desc, proj_loc, proj_start, proj_duration)
VALUES
('project', 'Proj 1', 'project one stuff', 'ruby mountains', '2015-01-01', 3),
('project', 'Proj 2', 'project two stuff', 'ruby mountains', '2015-01-01', 2),
('project', 'Proj 3', 'project three stuff', 'ruby mountains', '2015-10-01', 4),
('stage', 'Proj 1, Stage 1', 'stage 1 proj 1', 'southern ruby', '2015-01-01', 1),
('stage', 'Proj 1, Stage 2', 'stage 1 proj 2', 'southern ruby', '2016-01-01', 1),
('stage', 'Proj 1, Stage 3', 'stage 1 proj 3', 'southern ruby', '2017-01-01', 1);
@kissmygritts
kissmygritts / projects.sql
Created August 26, 2017 01:36
projects sql testing
CREATE TABLE projects (
id serial PRIMARY KEY,
type text,
proj_name text,
proj_desc text,
proj_loc text,
proj_start date,
proj_duration integer,
attributes jsonb,
created_at timestamp with time zone DEFAULT now(),
@kissmygritts
kissmygritts / ColumnSet.js
Created August 25, 2017 02:25
ColumnSet help
'use strict'
const sql = require('../sql').elements
const helpers = require('pg-promise')().helpers
const cs = new helpers.ColumnSet([
'?id',
{
name: 'animal_id'
}, {
name: 'species_id'
@kissmygritts
kissmygritts / nestedCards.vue
Created June 8, 2017 22:11
nestedCards.vue
<div class="card">
<h4 class="card-header" @click="toggleVisibility('')">
""
</h4>
<div class="card-block" v-if="">
<div class="p-card" v-for="" v-bind:class="{ 'p-card-odd': oddIndex(index) }">
<div class="p-card-header">
<button type="button" class="close" @click="deleteDynElement('', index)">
<span>&times;</span>
-- 1.4 example
-- restaurants
CREATE TABLE lu_franchises (
id char(3) PRIMARY KEY,
franchise varchar(30)
);
-- creating lookup table
INSERT INTO lu_franchises(id, franchise)
VALUES