This file contains 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
'use strict'; | |
var request = require('request'); | |
module.exports = function (grunt) { | |
require('time-grunt')(grunt); | |
require('load-grunt-tasks')(grunt); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), |
This file contains 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
// This mechanism assumes you have an api.models hash of models - adjust to suit your actual location. | |
api.utils.recursiveDirectoryGlob(__dirname + '/../models', 'js').forEach(function(filename) { | |
var modelName = (filename.replace(/\\/g, '/').split('/')).pop().replace('.js', ''); | |
console.log('ORM: Loading model ' + modelName); | |
models[modelName] = sequelize.import(filename); | |
}); | |
// Pretend we've had a database failure when creating roles | |
Object.keys(api.models).map(function(modelName) { |
This file contains 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
ASAPP DevOps and Systems Engineering Challenge | |
============================================== | |
v0.1 | |
Welcome to your challenge project! | |
You have two timeline options. If you live outside of NY and would have to fly in for your onsite, we strongly prefer that you take option 1. If coming in to the office is easy for you, then whichever you prefer is great. | |
Option 1: Code at home, half-day at ASAPP |
This file contains 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
exports.action = { | |
name: 'myAction', | |
description: 'Perform some work with multiple async steps.', | |
async: true, | |
run: function(api, data) { | |
var firstRecord = api.await(api.orm.getFirstRecord()); | |
// We will async await this result here before proceeding. No callback nesting or promise chaining! | |
if (!firstRecord) { | |
throw new NotFoundError(); | |
} |
This file contains 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
export CLICOLOR=1 | |
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx | |
export EVENT_NOKQUEUE=1 | |
export GIT_MERGE_AUTOEDIT=no | |
export MACHINE_NATIVE_SSH=1 | |
export HOMEBREW_GITHUB_API_TOKEN=GETYOUROWNFREAKINGTOKEN | |
export LANG=en_US.UTF-8 | |
alias v="ls -l" | |
alias glg='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --date=relative' |
This file contains 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
nginx: | |
log_driver: '' | |
labels: | |
io.rancher.container.pull_image: always | |
tty: true | |
log_opt: {} | |
image: nginx:alpine | |
links: | |
- nr-db:mysql | |
stdin_open: true |
This file contains 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
var publicApi = {}, | |
api; | |
publicApi.function1 = function() { | |
// If you call api.myInitializer1.function1() everything should be normal here, callee, whatever... | |
}; | |
publicApi.function2 = function() { | |
}; |
This file contains 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
// Set NODE_ENV to test so AH creates api.specHelper for us | |
process.env.NODE_ENV = 'test'; | |
process.env.ACTIONHERO_CONFIG = 'config,local-config'; | |
// Get ActionHero ready to go | |
var actionheroPrototype = require('actionhero').actionheroPrototype, | |
actionhero = new actionheroPrototype(), | |
running = false; | |
global.api = null; |
This file contains 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
var pendingNotifications = {}, | |
publicApi = {}, | |
api; | |
// Dummy function to avoid an Unhandled Rejection error if the user is offline. Prevents us | |
// from needing to .catch() the notification result in every spot where we call it. Also a | |
// useful debugging point, so we don't just null it out. | |
function userNotOnline() { | |
} |
OlderNewer