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
const { AuthenticationService, JWTStrategy } = require('@feathersjs/authentication'); | |
const { LocalStrategy } = require('@feathersjs/authentication-local'); | |
const { expressOauth, OAuthStrategy } = require('@feathersjs/authentication-oauth'); | |
class GoogleStrategy extends OAuthStrategy { | |
// https://github.com/feathersjs/feathers/blob/be91206e3dba1e65a81412b7aa636bece3ab4aa2/packages/authentication-oauth/src/strategy.ts#L113-L119 | |
async createEntity(profile, params) { | |
// check if the user exists and has access | |
if (youShouldLetHimIn) { |
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
class GitHubStrategy extends OAuthStrategy { | |
async getProfile (authResult) { | |
const accessToken = authResult.access_token; | |
// get private email | |
let { data } = await axios.get('https://api.github.com/user/emails', { | |
headers: { authorization: `Bearer ${accessToken}` } | |
}); | |
// get user data |
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
<template> | |
<div v-for="user in users" v-bind:key="item._id"> | |
{{ user.email }} | |
</div> | |
</template> | |
<script> | |
import { mapActions } from 'vuex' | |
const REDIRECT_PATH = '/some/url/to/login'; |
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
/* eslint-disable no-console */ | |
const logger = require('./logger'); | |
const app = require('./app'); | |
const port = app.get('port'); | |
// const server = app.listen(port); => moved | |
// added for https support | |
const https = require('https'); | |
const fs = require('fs'); |
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
// ref: https://stackoverflow.com/a/37576787/2027670 | |
async function parallelFiles () { | |
const files = []; // some data | |
await Promise.all(files.map(async (file) => { | |
const contents = await fs.readFile(file, 'utf8') | |
console.log(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
// ref: https://stackoverflow.com/a/37576787/2027670 | |
async function sequentialFiles () { | |
const files = []; // some data | |
for (let file of files) { | |
const contents = await fs.readFile(file, 'utf8'); | |
console.log(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
# Testing with sheell | |
echo "Hello World" | |
echo "Done!" | |
# remember to include like this: | |
# [<script src="https://gist.github.com/nriesco/dd411526ffe2bc4633bb19cc1d0a3a1a.js"></script>](<script src="https://gist.github.com/nriesco/dd411526ffe2bc4633bb19cc1d0a3a1a.js"></script>) |
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
<script src="//code.jquery.com/jquery-1.12.0.min.js"></script> | |
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> | |
<script type="text/javascript"> | |
google.charts.load('current', { 'packages': ['gantt'] }); | |
google.charts.setOnLoadCallback(drawChart); | |
function daysToMilliseconds(days) { | |
return days * 24 * 60 * 60 * 1000; | |
} |
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
import can from 'can'; | |
import superMap from 'can-connect/can/super-map/'; | |
import tag from 'can-connect/can/tag/'; | |
import 'can/map/define/define'; | |
import feathers from './feathers'; // Import the feathers instance. | |
export const DisplayPurchaseOrderItems = can.Map.extend({ | |
define: {} | |
}); |
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
{{#if displayPurchaseOrderItemsPromise.isPending}} | |
<div class="list-group-item list-group-item-info"> | |
<h4 class="list-group-item-heading">Loading...</h4> | |
</div> | |
{{/if}} | |
{{#if displayPurchaseOrderItemsPromise.isRejected}} | |
<div class="list-group-item list-group-item-danger"> | |
<h4 class="list-group3--item-heading">Error</h4> | |
</div> | |
{{/if}} |
NewerOlder