Skip to content

Instantly share code, notes, and snippets.

View AndrewHenderson's full-sized avatar

Andrew Henderson AndrewHenderson

View GitHub Profile
iimport {
isArray,
isObject,
isNull,
isNil,
isEqual,
isUndefined,
keys,
uniq,
each,
@AndrewHenderson
AndrewHenderson / build.js
Last active December 1, 2022 00:06
Rollup, Gulp, and Babel (ES6)
// Gulp
import gulp from 'gulp';
import plumber from 'gulp-plumber';
import file from 'gulp-file';
import filter from 'gulp-filter';
import rename from 'gulp-rename';
import sourcemaps from 'gulp-sourcemaps';
import uglify from 'gulp-uglify';
// Rollup
import { rollup } from 'rollup';
{
eventStream: {
modelChange: function(stream) {
stream.filter(function(val){
return val.model.name == 'receiptModel'
})
.filter(function(val){
return val == val.model.isNew();
})
.onValue(onNewReceipt);
POST preapprovalsummaries
{
data: {
type: 'preapprovalsummaries',
attributes: {
expenseReportId: 1,
preApprovalId: 2
}
}
}
// GET /preapprovals/1?applyExpenseHeaderId=3 HTTP/1.1
{
"links": {
"self": "/preapprovals/1"
},
"data" : {
"type" : "preapprovals",
"id" : "1",
"attributes" : {
@AndrewHenderson
AndrewHenderson / apply-preapproval-preview.txt
Created November 4, 2015 20:28
Applied Pre-Approvals JSON API Example
//GET /expensereports/1/relationships/applicablepreapprovals HTTP/1.1
//Content-Type: application/vnd.api+json
//Accept: application/vnd.api+json
{
"links": {
"self" : "/expensereports/1/relationships/applicablepreapprovals",
"related": "/expensereports/1/applicablepreapprovals"
},
"data" : [
PATCH /preapprovallinitems/1
{
"data": {
"type": "preapprovallinitems",
"id": "1",
"attributes": {
"name": "Updated Report"
}
},
"included": [{
@AndrewHenderson
AndrewHenderson / transactionAggregatesAPI.js
Last active August 29, 2015 14:21
Proposed Transactions Aggregates API
// I'm proposing we use the CR version at the bottom with the flexibility
// to later wrap it in the JSON API envelope.
// JSON API
// GET http://chromeriver.com/transactionAggregates
{
"links": {
"self": "http://chromeriver.com/transactionAggregates",
"next": "http://chromeriver.com/transactionAggregates?page[offset]=2",
@AndrewHenderson
AndrewHenderson / transactionGroupsAPI.js
Last active August 29, 2015 14:21
Proposed Transaction Groups API
// Retrieving a TransactionGroup
// ------------------------------------------------------
// GET /transactionGroups
// Content-Type: application/vnd.api+json
// Accept: application/vnd.api+json
{
"links": {
"self": "http://chromeriver.com/transactionGroups",
"next": "http://chromeriver.com/transactionGroups?page[offset]=2",
@AndrewHenderson
AndrewHenderson / gist:a5f403039386dc4efebc
Last active August 29, 2015 14:19
Transaction Sets
// REQUEST
// transactionSets POST
// transactionSets/23 PUT
{
transactionIds: [315, 311]
}
// RESPONSE