Skip to content

Instantly share code, notes, and snippets.

View caseywatts's full-sized avatar
Hi, I’m Casey!

Casey Watts caseywatts

Hi, I’m Casey!
View GitHub Profile
@caseywatts
caseywatts / README.md
Created February 19, 2019 20:54
Where in the World?
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@caseywatts
caseywatts / README.md
Last active November 15, 2018 22:07
Code of Conduct in Ember

Todd Evanoff and I just did a quick survey of Code of Conduct in Ember plugins.

For posterity, the top 10 addons on Ember Observer as of Nov 15, 2018:

@caseywatts
caseywatts / gist:c5d840862d9693c6a8d84bd2bd83c3d3
Created October 12, 2018 15:28
Mirage Includes & Relationship Records

Mirage Includes

The way mirage mocks out our included records isn't accurate currently.

An example: In a request for addon, it includes some information about the relationship to company.

The "relationship object" we get looks like

company: { id: 123 }
@caseywatts
caseywatts / jscodeshift.md
Last active January 31, 2020 10:21
Sharing jscodeshift codemods

codemod-cli is straightforward - but it's especially made for codemod projects that have multiple transforms. For a single transform, we could/should have a simpler interface for consumers.

Here are three ways to share your codemod with others. The npx methods require you npm publish the repo.

Method 1 - global install, using githubusercontent

Easiest method for the developer, especially if you only have one transform and/or if you're not using codemod-cli. This uses the github-hosted raw.githubusercontent link to run it, kinda like running it from a gist. Here's an example using ember-mocha-codemods.

npm install -g jscodeshift
@caseywatts
caseywatts / 0 README.md
Last active May 2, 2024 05:47
Generate Graphviz Files for Project

short url: caseywatts.com/graphviz

Graphviz is like markdown, for diagrams.

It's a tool that can transform text input into a "directed graph" output, which is nodes pointing to other nodes. You can use it for architecture diagrams, DB diagrams, documentation for users, etc.

graphviz-it

You'll want to use a tool with a two-pane layout - the left side is the source text, the right side is the image output.

  • For just you working on it, use (shown above; it has more features)
@caseywatts
caseywatts / bubbles.dot
Last active May 2, 2024 06:05
Bubbles! Graphviz Diagram
digraph bubbles {
node [
color=lightcyan2,
style=filled,
fillcolor=lightcyan
]
edge [
color=white
]

Keys

G C F Bb Eb Ab
1 0 1 2 3 4
F# _ Bb Bb, Eb Bb, Eb, Ab Bb, Eb, Ab, Db
Song Key Starting Note
Gloucestershire Wassail G D (5) -> G (1)
@caseywatts
caseywatts / 0 README.md
Last active May 2, 2024 06:06
d3 & c3 npm shim to es6 module for Ember
@caseywatts
caseywatts / json-pretty-print.js
Last active May 2, 2024 06:06
Ember helper {{json-pretty-print someJson}}
// app/helpers/json-pretty-print.js
// usage {{json-pretty-print someJson}}
// see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument
import Helper from '@ember/component/helper';
export default Helper.extend({
compute(params, hash) {
const [json] = params;
return JSON.stringify(json, null, ' ');