This file contains hidden or 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
| module.exports = async () => 'test a thing'; |
This file contains hidden or 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
| module.exports = async () => 'test a thing'; |
This file contains hidden or 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
| /** | |
| * Creates an e-mail list from provided user data | |
| */ | |
| module.exports = async (users = []) => { | |
| return users.map(user => { | |
| return `${user.first_name} <${user.email}>`; | |
| }).join(', '); | |
| } |
This file contains hidden or 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 A { | |
| constructor () { | |
| this.value = 0; | |
| } | |
| valueOf () { | |
| return ++this.value; | |
| } | |
| toString () { | |
| return this.valueOf(); | |
| } |
This file contains hidden or 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
| module.exports = async () => 'testing gist'; |
This file contains hidden or 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 lib = require('lib'); | |
| // We deployed our dentist rating service as "dentists"... | |
| // callback style | |
| lib.user.dentists({ratings: [1, 2, 5, 5]}, (err, result) => { | |
| // handle | |
| }); | |
| // promise style |
This file contains hidden or 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
| /** | |
| * async / await supported natively! | |
| * @param {array} ratings Our ratings out of five from top dentists | |
| * @returns {object} | |
| */ | |
| module.exports = async function (ratings = [5, 5, 3, 5]) { | |
| let lastRating = await getDentistRatingWhoIsSlowToRespond(); | |
| ratings.push(lastRating); | |
This file contains hidden or 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 is a FaaSlang-compliant function. It uses a modified ESDoc/JSDoc | |
| * parser to read comments and determine types to implement type-safety | |
| * mechanisms at execution time, or can intuit types based on default. | |
| * It also performs static analysis to ensure comments match function footprints. | |
| * @param {string} name Your name | |
| * @param {string} age Your age | |
| * @returns {string} | |
| */ | |
| module.exports = (name = 'Arya Stark', age = 18, context, callback) => { |
This file contains hidden or 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 Nt = require('ntseq'); // NtSeq library | |
| module.exports = (params, callback) => { | |
| // Get query and genome sequences, as well as offset | |
| let q = (params.kwargs.q || '') + ''; | |
| let seq = (params.kwargs.seq || '') + ''; | |
| let offset = Math.max(0, parseInt(params.kwargs.offset) || 0); | |
| // Read sequences |
This file contains hidden or 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 f = require('f'); | |
| const fs = require('fs'); | |
| const async = require('async'); | |
| const Nt = require('ntseq'); | |
| // Get first 1,000,000 nt of E. coli K12 genome | |
| const K12 = fs.readFileSync('./seq/ecolik12.txt').toString().substr(0, 1000000); | |
| module.exports = (params, callback) => { |
NewerOlder