Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Wheale DesignByOnyx

View GitHub Profile
@DesignByOnyx
DesignByOnyx / conducto-invite-flow.xml
Created Jul 28, 2020
Flow diagram for use on https://www.diagrameditor.com/. Create a new diagram and to to Extras -> Edit Diagram... and paste the xml.
View conducto-invite-flow.xml
<mxGraphModel dx="2189" dy="617" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="VkLRRX-poRybO8Ou6MYJ-8" value="No" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="VkLRRX-poRybO8Ou6MYJ-1" target="VkLRRX-poRybO8Ou6MYJ-7" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="VkLRRX-poRybO8Ou6MYJ-10" value="Yes" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="VkLRRX-poRybO8Ou6MYJ-1" target="VkLRRX-poRybO8Ou6MYJ-9" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
View update-blog-post-with-tags.js
const { tags, ...blogPost } = {
"id": 1, // Notice the blog post has an "id" since we are updating an existing post
"title": "My first blog post",
"body": "...",
"tags": [
{ "id": 1, "text": "sequelize" }, // the existing tag has an "id"
{ "text": "postgres" } // the new tag does not have an "id"
]
};
View create-blog-post-with-new-and-existing-tags.js
const { tags, ...blogPost } = {
"title": "My second blog post",
"body": "...",
"tags": [
{ "id": 1, "text": "sequelize" }, // the existing tag has an "id"
{ "text": "database" } // the new tag does not have an "id"
]
};
const newPost = db.create('blog_posts', blogPost);
View create-blog-post-with-tags.js
const { tags, ...blogPost } = {
"title": "My first blog post",
"body": "...",
"tags": [
{ "text": "sequelize" },
{ "text": "feathersjs" },
{ "text": "many-to-many" }
]
};
View create-blog-post-with-tags.json
{
"title": "My first blog post",
"body": "...",
"tags": [
{ "text": "sequelize" },
{ "text": "feathersjs" },
{ "text": "many-to-many" }
]
}
@DesignByOnyx
DesignByOnyx / github-auto-link-yaml-refs-bookmarklet.js
Last active Sep 10, 2019
Bookmarklet to automatically turn YAML $refs into hyperlinks.
View github-auto-link-yaml-refs-bookmarklet.js
View keybase.md

Keybase proof

I hereby claim:

  • I am DesignByOnyx on github.
  • I am ryanwheale (https://keybase.io/ryanwheale) on keybase.
  • I have a public key whose fingerprint is 0DAA EB7B A5F5 F7AB 35F4 7593 818E 802D A122 192F

To claim this, I am signing this object:

@DesignByOnyx
DesignByOnyx / postgis-geojson-liaison.js
Created Nov 9, 2018
Helpful utility for converting postgis data into GeoJSON as it comes out of the db, and vice versa.
View postgis-geojson-liaison.js
var wkx = require('wkx')
var pg = require('pg')
var pgUtil = require('pg/lib/utils')
const geoParser = {
init(knex){
// 1. Convert postgis data coming out of the db into geoJSON
// Every postgres installation will have different oids for postgis geo types.
knex
.raw('SELECT oid, typname AS name FROM pg_type WHERE typname IN (\'geography\', \'geometry\');')
@DesignByOnyx
DesignByOnyx / ylem-model.md
Last active May 25, 2018
This is an attempt to describe a model layer for ylem
View ylem-model.md
  1. Define your models with a transport (this is just sugar for can-connect)

    import { Model,  transport } from 'ylem-model';
    
    const Person = Model({
      id: { type: 'number', identity: true },
      name: { type: 'string' },
      email: { type: 'string' },
      age: { type: 'number' },
View rvm-init-method-affects-parent.js
import React from 'react';
import DefineMap from 'can-define/map/map';
import ObservationRecorder from 'can-observation-recorder';
import Component from 'react-view-model/component';
class Parent extends Component {
static ViewModel = DefineMap.extend({});
render() {
console.log('Parent render');
return <Child time={new Date()} />;