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 port = 1337; | |
app.get('/ping', (request, response) => { | |
response.send('Pong!'); | |
}); | |
app.listen(port, () => { | |
console.log(`Server running on port ${port}`); |
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 gm = require('gm'); | |
const width = 300; | |
const height = 400; | |
gm('/path/to/image/file') | |
.crop(width, height) | |
.write('/path/to/output', (err) => { | |
if (err) { | |
console.log(err); | |
} |
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 gm = require('gm'); // Require the GraphicsMagick wrapper for node | |
const fs = require('fs'); // To clean up after the we generate the output image file | |
const port = 1337; | |
app.get('/ping', (request, response) => { | |
response.send('Pong!'); | |
}); |
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 gm = require('gm'); | |
const fs = require('fs'); | |
const port = 1337; | |
app.get('/ping', (request, response) => { | |
response.send('Pong!'); | |
}); |
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 gm = require('gm'); | |
const width = 200; | |
const height = 50; | |
gm('/path/to/image/file') | |
.resize(width, null) // This will resize the width while maintaining the aspect ratio | |
.write('/path/to/output', (err) => { | |
if (err) { | |
console.log(err); | |
} |
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 gm = require('gm'); | |
const fs = require('fs'); | |
const port = 1337; | |
app.get('/ping', (request, response) => { | |
response.send('Pong!'); | |
}); |
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
function Queue () { | |
this.values = []; | |
this.count = 0; | |
} |
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
function Queue() { | |
this.values = []; | |
this.count = 0; | |
} | |
Queue.prototype.enqueue = (newValue) => { | |
this.values[this.count] = newValue; // Insert the new value in the end | |
this.count++; // Update the count to reflect the addition | |
} |
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
function Queue() { | |
this.values = []; | |
this.count = 0; | |
} | |
Queue.prototype.enqueue = (newValue) => { | |
this.values[this.count] = newValue; | |
this.count++; | |
} |
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
function Queue() { | |
this.values = []; | |
this.count = 0; | |
} | |
Queue.prototype.enqueue = (newValue) => { | |
this.values[this.count] = newValue; | |
this.count++; | |
} |
OlderNewer