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'; | |
const NodeCache = require('node-cache'); | |
const chalk = require('chalk'); | |
const origins = new NodeCache(); | |
const ApiKey = require('./models/api-key.model'); | |
// https://www.npmjs.com/package/node-cache | |
const cache = {}; |
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'; | |
const mongoose = require('mongoose'); | |
const sid = require('shortid'); | |
const ident = require('crypto-random-string'); | |
const origins = require('../origins-cache'); | |
const schema = new mongoose.Schema({ | |
client_id: { // Used for Public API Keys. Kept in for context to show you would most likely reuse this table if you have a table for storing and generating public API keys. | |
type: String, |
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
// Super Class | |
class FooAPI { | |
static get(endpoint) { | |
// logic to get a token and send a GET request to the API | |
} | |
} | |
// Child Class (aka Module) | |
class Ping extends Foo { | |
static checkHealth() { | |
// Use the super keyword to call the parent FooAPI class get method. |
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"; | |
module.exports = function (gulp, _p, _o, s, d) { | |
if (!d) { | |
d = _o.global.outDir; | |
} | |
return function () { | |
gulp.src(s) | |
.pipe() | |
.dest(d); |
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
[HttpPost, Route("api/aws/upload")] | |
public async Task<IHttpActionResult> Upload() | |
{ | |
if (!Request.Content.IsMimeMultipartContent()) | |
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); | |
var provider = new MultipartMemoryStreamProvider(); | |
await Request.Content.ReadAsMultipartAsync(provider); | |
foreach (var file in provider.Contents) | |
{ |
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
.helper-no-margin { | |
margin: 0 | |
} | |
.helper-no-padding { | |
margin: 0 | |
} | |
.helper-no-margin-left { | |
margin-left: 0 !important; |
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
// Requires momentjs and faker.js. | |
//usage | |
/* | |
<div class="scaffold-user"> | |
<span class="scaffold-name"></span> OR <span class="scaffold-name">{{scaffold-name}} - other text here</span> | |
<span class="scaffold-initials"></span> | |
<span class="scaffold-email"></span> | |
</div> |
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
{"lastUpload":"2018-05-20T18:35:09.653Z","extensionVersion":"v2.9.2"} |
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
//usage -- | |
//<i class="show-hide" data-elem="#hidden-content"></i> | |
//<div id="my-content" class="hidden">I'm hidden until the icon is clicked</div> | |
$(document).ready(function() { | |
$('.show-hide').on('click', function(e) { | |
e.preventDefault(); | |
var elem = $(this).attr('data-elem'); | |
$(elem).toggleClass('hidden'); | |
$(this).toggleClass('glyphicon-menu-down'); |
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'; | |
require('dotenv').config(); | |
let fs = require('fs'); | |
let moment = require('moment'); | |
let ts = moment().format('YYY_MM_DD'); | |
let filename = `unit/${ts}_unit.jpg` |