Skip to content

Instantly share code, notes, and snippets.

View kosinix's full-sized avatar

Kosinix kosinix

  • Philippines
View GitHub Profile
@devarajchidambaram
devarajchidambaram / spawn vs child_process
Created August 28, 2018 13:32
Difference between spawn and exec functions of child_process
Difference between spawn and exec functions of child_process
The Node.js Child Processes module (child_process) has two functions spawn and exec, using which we can start a child process to execute other programs on the system. Those new to child_process may wonder why there are two functions to do the same thing, and which one they should use. I'll explain the differences between spawn and exec to help you decide when to use what.
The most significant difference between child_process.spawn and child_process.exec is in what they return - spawn returns a stream and exec returns a buffer.
child_process.spawn returns an object with stdout and stderr streams. You can tap on the stdout stream to read data that the child process sends back to Node. stdout being a stream has the "data", "end", and other events that streams have. spawn is best used to when you want the child process to return a large amount of data to Node - image processing, reading binary data etc.
child_process.spawn is "asynchronously asynchr
@ericandrewlewis
ericandrewlewis / gist:95239573dc97c0e86714
Last active December 12, 2023 09:52
Setting up a WordPress site on AWS

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

@BaylorRae
BaylorRae / doc_block.php
Created July 17, 2012 20:38
Parse PHP Doc Blocks
<?php
class DocBlock {
public $docblock,
$description = null,
$all_params = array();
/**
* Parses a docblock;