PHP date arithmetic

strtotime() function can be used for date arithmetic. Following are some examples:

Get next date

print date('Y-m-d', strtotime('+1 day', strtotime('2013-09-30')));

Prints

2013-10-01

Get previous month

print date('Y-m-d', strtotime('-1 month', strtotime('2013-09-30')));

Prints

2013-08-30

Go back 5 years

print date('Y-m-d', strtotime('-5 year', strtotime('2013-09-30')));

Prints

Content search on Windows 7

Windows 7 search interface is different from previous versions of windows and it can be frustrating for new users. The Start > search field is used for all search i.e. programs, files, file contents, and even outlook emails search. By default, search is limited to file names and properties like date and file type. The search does not look inside the files so if you are searching for a file whose name you forgot but remember some lines of text, you will not be able to find it with the default settings.

Installing drupal using vagrant

If you are running a windows system, it can be difficult to setup several pristine drupal development environments. The simple solution is to install a virtual machine, setup your drupal such that it has no affect on the rest of your system. A better solution is to use a virtual machine workflow system that will allow you to easily create and work with several virtual machines. Vagrant is such a system and in here you will learn how to set it up.

Vagrant error occurred while downloading the remote file

Problem

An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again.

Cause

You are running vagrant init outside your virtual box

Solution

cd to your vagrant directory. If you did a vagrant box add solar, then your virtual box is in the directory solar.

$ cd solar

If there is not VagrantFile, run the following command:

$ vagrant init 

If there is a VagrantFile

$ vagrant up

Getting started with Homebrew

Homebrew is a package manager for Mac OS.

Installation

  1. Download and install Xcode from Mac store if you don't already have it installed
  2. In a terminal, type the following code

    xcode-select --install
    
  3. Run the following command

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"    
    

Some commands

brew search Search for an application:

Brackets /bin/sh: node: command not found

Problem

JavaScript code not running on Brackets.

Error Message

/bin/sh: node: command not found
Program exited with status code of 127

Root Cause

Brackets cannot find node binary file.

Solution

Open terminal and type the following commands and note the addressed returned:

which node
which npm

Click on Node.js > Configuration... from the main menu. Then copy/paste the paths to binary files you retrieved in the command line. For example:

What is a Full Stack

Full-stack is a complete JavaScript solution which involves JavaScript on both client-side and server-side. There are many full-stack solutions but MEAN stack is the most widely used solution. There are many different variations of the full-stack but it essentially involves:

Pages