Skip to content

Instantly share code, notes, and snippets.

View santiagogm1995's full-sized avatar
🤓
I do things... or so I think

Santiago González santiagogm1995

🤓
I do things... or so I think
View GitHub Profile
@pksorensen
pksorensen / node_zip_file_unix.js
Created June 23, 2013 10:50
How to return a zip file with express, nodejs on linux.
//http://stackoverflow.com/questions/5754153/zip-archives-in-node-js
var spawn = require('child_process').spawn;
app.get('/scripts/archive', function(req, res) {
// Options -r recursive -j ignore directory info - redirect to stdout
var zip = spawn('zip', ['-rj', '-', SCRIPTS_PATH]);
res.contentType('zip');
// Keep writing stdout to res
zip.stdout.on('data', function (data) {
@blogscot
blogscot / myPinkTruck.js
Last active November 19, 2021 03:53
Factory Pattern examples using ES6 syntax
class Car {
constructor(doors = 4, state = "brand new", color = "silver") {
this.doors = doors
this.state = state
this.color = color
}
}
class Truck {