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 primesLessThanN = (n) => { //* This can be processor intensive | |
| let primes = [] | |
| for(i = 0; i < n; i++) { | |
| if ( i <= 1) { //* no number <= 1 can be prime | |
| continue | |
| } | |
| let isPrime = true | |
| while( isPrime ) { |
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
| let primes = [ ] | |
| const findNextPrime = (primeArray) => { | |
| let foundPrime = false | |
| for(np = 2; !foundPrime; np++) { | |
| let isPrime = true | |
| while(isPrime){ | |
| for(p = 0; p < primeArray.length; p++) { | |
| if (np % primes[p] == 0) { | |
| isPrime = false | |
| break |
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 functions = require('firebase-functions'); | |
| const gcs = require('@google-cloud/storage')({keyFilename: 'service-key.json'}); | |
| const spawn = require('child-process-promise').spawn; | |
| const path = require('path'); | |
| const os = require('os'); | |
| const fs = require('fs'); | |
| exports.createCard = functions.firestore | |
| .document('work_cards/{cardID}') | |
| .onCreate((snap, context) => { |
NewerOlder