The Daily Awesome Blog Thoughts, stories and ideas.


sudo apt-get install supervisor


sudo service supervisor start
sudo supervisorctl reload


command=php artisan queue:listen

sudo supervisorctl

supervisor> status supervisor> reread queue: available supervisor> add queue queue: added process group supervisor> start queue queue: ERROR (already started) supervisor> status queue RUNNING pid 27174, uptime 0:00:11 supervisor> help supervisor> exit;

Renaming a Branch in Git

First, you want to change your local branch. This couldn’t be easier:

git branch -m my-hot-feature feature-15

Delete the remote branch with the old name: git push origin :my-hot-feature

Re-create the remote branch with the new name: git push origin feature-15

React JS

sync 2 states - change in UI triggers change in data model - chanfe in data model changes UI

Two way data binding: - key-value observing (KVO) - used in Ember.js, Knockout, Backbone and iOS - dirty checking - Angular.js

Virtual DOM - fast, in-memory representation of real DOM - when state of model changes, UI is rendered to virtual dom - React calculates difference in virtual dom - prior vs. new - React only updates what needs to be updated in the real DOM

react and react-dom separated into two components in order to reuse modules in rect-native - share components that behave same across platforms

React virtual DOM is a tree of react nodes. ReactNode: - ReactElement - light, stateless, immutable, virtual representation of a DOM element - ReactText - sring or text

ReactFragment is an array of ReactNodes

var React = require('react');
var ReactDOM = require('react-dom');
* React.createElement(type, props, children)
* type:
* - string: h1, div, p, etc.
* - React class is created by React.createClass() method
* props - js obejct passed from a parent element to a child element {className: 'header'}
* we use className because class is reserved in js
* children - child elements this element should have
* */
var reactElement = React.createElement('h1');
ReactDOM.render(reactElement, document.getElementById('react-application'));

MongoDB Group By

Laravel App on Digital Ocean

Get your $10 credit @DigitalOcean - that’s 2 month of server time - 512 MB/ 1 CPU/ 20 GB SSD/ 1000 GB Transfer

  1. Copy Keys ssh-copy-id user@ or cat ~/.ssh/ | ssh user@ "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"–2

  2. Error logs: /var/log/apache/error.log

  3. Installing composer curl -sS | php mv composer.phar /usr/local/bin/composer

  4. Installing curl sudo apt-get update sudo apt-get install php5-curl

  5. Add swap memory

  • First try to run composer this way:

php -d memory_limit=-1 /usr/local/bin/composer update If it works, just add memory_limit=-1 to your php.ini and you should be good.

  • If it doesn’t and your box is a Homestead or Ubuntu, check if you have swap memory in your server:

free -h

And you should see something like: Swap: 2.0G 93M 1.9G

If you don’t, you better add some to your box:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=2048k
sudo mkswap /swapfile
sudo swapon -a
echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
echo 10 | sudo tee /proc/sys/vm/swappiness
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
chown root:root /swapfile
sudo chmod 0600 /swapfile

Enable rewrite module

sudo a2enmod rewrite sudo service apache 2 restart