This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSONAPI - Kabab case only. No camel case | |
data | |
type (plural) | |
id (string of a number) | |
attributes (payload) | |
relationships (minial JSONAPI form inside. Type (can be singular or plural) and id. can also be an Array) | |
links (optional but ember-data does support links) | |
included (optional. Type, id and attributes. Always an Array) | |
==================================================================== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ember Component Learnings: | |
========================== | |
Don't ever assign a dynamic value to a id or name attribute of a field | |
Don't share state between components. Always reset or init properties via the init method. Same for mixins. | |
Warning: | |
======== | |
Because components are sealed from outside events. It challenging to | |
get them to refresh on command. To pull this off you essentially need | |
them to observe a property on a controller in order to get them to refresh. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Check to see if promise is already running | |
if (this.isRunning) { return; } | |
//Promise is success, but we need to check on the parent before we make | |
changes to the parent. | |
if (this.isDestroyed) { return; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Node best practices: | |
#!/usr/bin/env node | |
'use strict'; | |
// Provide a title to the process in `ps` | |
process.title = 'description of what is actually running'; | |
Use "nopt" package for option parsing from command line input. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Regex tips for JOI: | |
^ asserts that the regular expression must match at the beginning of the subject | |
[] is a character class - any character that matches inside this expression is allowed | |
A-Z allows a range of uppercase characters | |
a-z allows a range of lowercase characters | |
. matches a period rather than a range of characters | |
\s matches whitespace (spaces and tabs) | |
_ matches an underscore | |
- matches a dash (hyphen); we have it as the last character in the character class so it doesn't get interpreted as being part of a character range. We could also escape it (\-) instead and put it anywhere in the character class, but that's less clear |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To add code completion for node.js | |
================================== | |
sudo npm install typings --global | |
typings search --name node | |
typings install env~node --global --save | |
Then I added the following to the top of my index.js file. | |
/// <reference path="typings/index.d.ts"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
yenConverter: Ember.inject.service(), | |
actions: { | |
switchCurrency(){ | |
this.get('yenConverter').switchCurrency(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'EAM V.2.0.0' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const {$}= Ember; //JQuery reference for events | |
import layout from '../templates/components/checkbox-component'; | |
const { | |
Component, | |
get | |
} = Ember; | |
const MyComponent = Ember.Component.extend({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const {$}= Ember; //JQuery reference for events | |
import layout from '../templates/components/checkbox-component'; | |
const { | |
Component, | |
get | |
} = Ember; | |
const MyComponent = Ember.Component.extend({ |