Skip to content

Instantly share code, notes, and snippets.

Colin Nelson orthros

  • Seattle
Block or report user

Report or block orthros

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
@orthros
orthros / composition.js
Created Apr 10, 2018
Quick example of composing objects (and functions in Javascript)
View composition.js
function worker(x) {
console.log("Look at me I'm calling some function");
if('someFunction' in x) {
x.someFunction();
}
else{
console.log("Wait... there's nothing here");
}
};
View stitchUpdateClient.js
const client = new stitch.StitchClient(APP_ID);
const db = client.service('mongodb', 'mongodb-atlas')
.db(APP_DB);
function displayIssuesOnLoad() {
client.authenticate('apiKey', APP_API_KEY)
.then(displayIssues);
}
function displayIssues() {
View stitchConfig.js
const APP_ID = "githubissuelist-lkmxz";
const APP_DB = 'ghdata';
const APP_COLLECTION = 'issues';
const APP_API_KEY = '<YOUR API KEY HERE>';
View htmlRoughConcept.html
<html>
<head>
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
<script src="../static/scripts/stitch.min.js"></script>
<script src="../static/scripts/config.js"></script>
<script>
displayIssuesOnLoad() {
//Connect to stitch then display issues
}
displayIssues(){
View stitchExpansionExpression.json
{
"expression": {
"owner_id": "<API USER ID HERE>",
"issue": "%%vars.issue"
}
}
View stitchProjectIssue.json
{
"projection": {
"issue.html_url": 1,
"issue.id": 1,
"issue.title": 1,
"issue.comments": 1,
"issue.created_at": 1,
"repository.name": 1,
"repository.html_url": 1,
}
View stitchValidIssue.json
{
"expression": {
"issue": {
"%exists": true
}
},
"action": {
"%in": [
"opened"
]
View invalidPR.json
{
"pull_request":{
},
"action":"closed"
}
View validPR.json
{
"pull_request" : {
},
"action": "opened"
}
You can’t perform that action at this time.