Skip to content

Instantly share code, notes, and snippets.

View harmlessprince's full-sized avatar
🏠
Working from home

Adewuyi Taofeeq Olamilekan harmlessprince

🏠
Working from home
View GitHub Profile

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

Sometimes we need to run multiple nodejs app on same server with different domain or sub domain like admin.domain.com, api.domain.com and also need to run both nodejs or reactjs app concurrently. We can do this using 2 things , first of all we need to install nginx in our server for reverse proxy to connect different domain, and for running multiple nodejs app concurrently we can use PM2 NodeJs Process Manager

Please Make sure that you have installed these things on your server

  • NodeJS
This file has been truncated, but you can view the full file.
[
{
"id": 233,
"name": "United States",
"iso3": "USA",
"iso2": "US",
"numeric_code": "840",
"phone_code": "1",
"capital": "Washington",
<?php
class SendMail
{
private $sendTo;
private $from;
private $name;
private $subject;
private $message;
private $headers;
private $attachment;
<?php
return [
[
'code' => 'BAG',
'desc' => 'Bag',
],
[
'code' => 'CTN',
'desc' => 'Carton'
],
@harmlessprince
harmlessprince / dateFormats.php
Created May 10, 2021 20:55
An array of 13 date formats
<?php
return [
[
"id" => 1,
"date_order" => 'MM/DD/YY',
'Description' => 'Month-Day-Year with leading zeros (02/17/2009)'
],
[
"id" => 2,
"date_order" => 'DD/MM/YY',
@harmlessprince
harmlessprince / SortAndMergeArrayOfStudentAges.php
Last active May 12, 2021 15:23
This function takes in two set of arrays, merges them and sort them using the quick sort algorithm. It returns a new array of the merged arrays in ascending order. It has a worst case time complexity of O(nlog(n)) and space complexity of 0(log(n))
<?php
function SortAndMergeArrayOfStudentAges($firstArray, $secondArray)
{
if (gettype($firstArray) != 'array' && gettype($secondArray) != 'array') {
return [];
}
if (gettype($firstArray) == 'array' && gettype($secondArray) != 'array') {
return quickSort($firstArray);
}
@harmlessprince
harmlessprince / CalculateProducts.php
Created May 2, 2021 09:43
Product of all other numbers an array
<?php
function CalculateProducts($array)
{
//check if array is undefined
if (!$array) {
return [];
}
//check if array has length equal to zero
if (count($array) == 0) {
@harmlessprince
harmlessprince / FindStartEndOfVal.php
Last active April 27, 2021 03:53
This function returns start and end position of of given value in an array
<?php
function FindStartEnd($array, $val)
{
$type = gettype($array);
try {
if (!$array) {
throw new Exception("Expects parameter 1 to be array and should contain at least one value");
}
if (!is_numeric($val)) {
please am final year studen.. been given the tille above as a project topic.. the application is expected to keep track of complete mobile log which includes SMS,images,call,browsing history.
i want to buuild this app using react. i was a able to get a package that keeps track of call history.. bit have not been able to see for of SMS,images,browsing histories..i need suggestions