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 warningCodeLookup = { | |
'66': 'warning_low_ink_yellow', | |
'67': 'warning_low_ink_black' | |
} | |
let information = DLLWrapper.GetInformation() | |
if (warningCodeLookup[information.warning_code] == "warning_low_ink_yellow { | |
console.log("Low Ink on Yellow Cartridge") | |
} |
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 docDefinition = { | |
content: ['This will show up in the file created'] | |
}; | |
generatePdf(docDefinition, (response) => { | |
// doc successfully created | |
res.json({ | |
status: 200, | |
data: response | |
}); |
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 pdfMakePrinter = require('pdfmake/src/printer'); | |
const fs = require('fs'); | |
function generatePdf(docDefinition, successCallback, errorCallback) => { | |
try { | |
const fontDescriptors = { ... }; | |
const printer = new pdfMakePrinter(fontDescriptors); | |
const doc = printer.createPdfKitDocument(docDefinition); | |
doc.pipe( |
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 formidable = require('formidable'); | |
module.exports = function (req, res, next) { | |
const formData = new formidable.IncomingForm(); | |
formData | |
.parse(req, (err, fields, files) => { | |
if (err) { | |
next(err); | |
} else { |
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
{ | |
"routes": [ | |
{ | |
"method": "POST", | |
"path": "/email", | |
"handler": "Email.send", | |
"config": { | |
"policies": [] | |
} | |
}, |
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 express = require('express') | |
const app = express() | |
const nunjucks = require('nunjucks') | |
const path = require('path') | |
nunjucks.configure([ | |
path.join(__dirname, 'node_modules/govuk-frontend/'), | |
path.join(__dirname, 'app/views/') | |
], { | |
autoescape: 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
await strapi.plugins['email'].services.email.send({ | |
to: ctx.request.body.to, | |
from: '[email protected]', | |
replyTo: '[email protected]', | |
subject: 'My message', | |
text: 'Text', | |
html: '<h1>Text</h1>' | |
}, config); |
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 pdfMakePrinter = require('pdfmake/src/printer'); | |
function generatePdf(docDefinition, callback) => { | |
try { | |
const fontDescriptors = { ... }; | |
const printer = new pdfMakePrinter(fontDescriptors); | |
const doc = printer.createPdfKitDocument(docDefinition); | |
let chunks = []; | |
const result; |
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 pdfMakePrinter = require('pdfmake/src/printer'); | |
function generatePdf(docDefinition, callback) => { | |
try { | |
const fontDescriptors = { ... }; | |
const printer = new pdfMakePrinter(fontDescriptors); | |
const doc = printer.createPdfKitDocument(docDefinition); | |
let chunks = []; | |
const result; |
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 gulp = require('gulp') | |
const sass = require('gulp-sass') | |
const compileStyles = () => { | |
return gulp.src([ | |
'app/assets/sass/**/*.scss' | |
]) | |
.pipe(sass()) | |
.pipe(gulp.dest('public/css/')) | |
.on('error', (err) => { |
OlderNewer