Skip to content

Instantly share code, notes, and snippets.

Josh Gough JogoShugh

Block or report user

Report or block JogoShugh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JogoShugh
JogoShugh / sample.md
Last active Nov 14, 2019
Api with next / prev links
View sample.md
@JogoShugh
JogoShugh / AssignMemberWithRoleJson.md
Last active Nov 5, 2019
Auto generated docs from tests
View AssignMemberWithRoleJson.md

Execute AssignMemberWithRole Operation upon a Scope for list of Members by OID Token

Demonstrates how to use a single command to assign multiple Members to a Scope along with Scope-specific roles each Member will have for the target Scope.

Setup

For the context of this example, the following request will setup the instance with the needed starting conditions:

POST http://host/instance/api/asset

@JogoShugh
JogoShugh / errors.md
Last active Sep 16, 2019
Bulk Error Handling
View errors.md

The following input payload specifies an array with 9 commands. These nine commands expand to 13 concrete actions for the backend API processor to execute. However, 12 of these actions are erroneous! Only one of them will succeed against the database running on the instance.

[
  {
    "from": "Animal"
  },
  {
    "from": "Scope",
    "where": {
@JogoShugh
JogoShugh / hack.js
Last active Apr 29, 2019
Card aging with duration in each status stint
View hack.js
$(document).arrive('.story-card', function() {
const story = $(this);
const applyStatusAging = () => {
const number = story.find('.number').text().trim();
const title = story.find('.title');
const query = `
from: PrimaryWorkitem
where:
Number: ${number}
View Red opacity for cards based on age.js
$('.advisory').each((index, elm) => {
const el = $(elm);
const text = el.text().trim().replace(/\s+|\r|\n+/gmi, '');
const matches = text.match(/\d+/gi);
if (matches) {
matches[0]+='d';
if (matches.length>1) matches[1]+='c';
const aging = `<span title='${text}'>${matches.join(', ')}</span>`;
const story = el.parents('.story-card');
el.parents('.aging').html(aging);
@JogoShugh
JogoShugh / 01 Specification and Automated API Test A.ts
Created Jan 9, 2019
VersionOne Bulk API automated test examples
View 01 Specification and Automated API Test A.ts
import {test, assetApiPost} from '../../lib/asset-api-helper';
const types = ['yaml', 'json'];
for(const type of types) {
test(`Update Description LongText scalar Attribute on two Defects, replacing one exact match string with another by OIDToken (${type})`, async t => {
const setupCommand = `
AssetType: Scope
Name: Test - Update Description LongText scalar Attribute on two Defects with find and replace Scope
Parent: Scope:0
View Bowling.sml
fun score rolls =
case rolls of
[] => 0
| n1::n2::n3::[] => n1 + n2 + n3
| n1::n2::n3::rest =>
if n1 = 10 then 10 + n2 + n3 + score (n2::n3::rest)
else if n1 < 10 andalso n1 + n2 = 10 then n1 + n2 + n3 + score (n3::rest)
else if n1 + n2 < 10 then n1 + n2 + score (n3::rest)
else score rest
| n1::rest => n1 + score rest
@JogoShugh
JogoShugh / Tally by File Extension CommitStream.js
Last active Mar 5, 2018
Tally By File Extension CommitStream.js
View Tally by File Extension CommitStream.js
function tally(root, prop) {
if (!root[prop]) root[prop] = 0;
root[prop]++;
}
function hasItems(array) {
return array && array.length > 0;
}
function tallyBy(state, key, length) {
View apiTest.ts
import {test, assetApiPost} from '../../lib/asset-api-helper';
const types = ['yaml', 'json'];
for(const type of types) {
test(`Update Description scalar Attribute on two Stories matching a where clause by Scope OIDToken (${type})`, async t => {
const setupCommand = `
AssetType: Scope
Name: Test - Update Description scalar Scope
Parent: Scope:0
View Can Create single Story Asset using explicit OidToken references for Scope required Relation Attribute and YAML as the Content-Type.md

Given this HTTP command using cURL or another client:

cURL command

curl -i -X POST \
   -H "Content-Type:text/yaml" \
   -H "Authorization:Bearer access-token-here" \
   -d \
'AssetType: Story
You can’t perform that action at this time.