Posted by & filed under Life, Software.

According to Larry Wall(1), the original author of the Perl programming language, there are three great virtues of a programmer; Laziness, Impatience and Hubris

  • Laziness: The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful and document what you wrote so you don’t have to answer so many questions about it.
  • Impatience: The anger you feel when the computer is being lazy. This makes you write programs that don’t just react to your needs, but actually anticipate them. Or at least pretend to.
  • Hubris: The quality that makes you write (and maintain) programs that other people won’t want to say bad things about.

Source: http://threevirtues.com/

Posted by & filed under Life.

“An illustrated guide for programmers and other curious people”

Great read for anyone that wants a refresher on algorithms and for learning the fundamentals of programming.

Best part is, it isn’t boring, you feel like you want to read the entire book in one sitting!

 

Source: https://www.manning.com/books/grokking-algorithms

Posted by & filed under Projects.

New projects added with screenshots!

The Projects Menu Item has been updated with some latest projects with screenshots. Feel free to take a look, including 2 new iOS apps: Photo Album and Live Feed!

Enjoy 🙂

Posted by & filed under Projects, Web Development.

Deployed some apps to Heroku:

Will update these with feature list and their own dedicated page on my website soon. Stay tuned!

Posted by & filed under CheatSheets, Web Development.

Some deployment steps for Heroku:

To deploy static html/css project:
1) Create an index.php file with the following content: <?php include_once(“home.html”); ?>
2) Rename your main or index.html to home.html
3) Deploy app

To deploy node.js project:
1) Ensure package.json has a start script and deploy app.
e.g. “scripts”: {
“test”: “echo \”Error: no test specified\” && exit 1″,
“start”: “node app.js”
},

To deploy to Heroku:
1) Install Heroku toolbelt and login account
2) Run “heroku create” in a git project
3) Run “heroku apps:rename <newProjectName>” to rename your project (optional)
4) Run “git push heroku master” to push project to heroku

Posted by & filed under CheatSheets, Concepts, Web Development.

Mongo DB Commands

A table of some useful mongo commands. These were used and tested on Cloud 9.

Command Description
$ mkdir data
$ echo ‘mongod –bind_ip=$IP –dbpath=data –nojournal –rest “$@”‘ > mongod
$ chmod a+x mongod
Setup Mongo to use a dir “data”
./mongod Start mongo server
mongo Start mongo shell
show dbs Print a list of all databases on the server.
use <dbName> Switch current database to <db>. The mongo shell variable db is set to the current database.
show collections Print a list of all collections for current database.
db.collection.find() Find all documents in the collection and returns a cursor.
db.collection.insert() Insert a new document into the collection. e.g. db.dogs.insert({name: “Victory”})
db.collection.update() Update an existing document in the collection.
db.collection.save() Insert either a new document or update an existing document in the collection.
db.collection.remove() Delete documents from the collection.
db.collection.drop() Drops or removes completely the collection.
mongod –repair –repairpath <path> Repairs the mongo db if incorrectly shut down.
Other useful mongo Links:

Mongo command reference: https://docs.mongodb.com/manual/reference/mongo-shell/

Setup mongo on cloud 9: https://community.c9.io/t/setting-up-mongodb/1717

Posted by & filed under CheatSheets, Concepts, Web Development.

GIT Commands

A table of some useful git commands.

Command Description
git init Create a new local repository
git rm -rf .git Undo git init
git add <filename>
git add .
Add one or more files to staging (index)
git status List the files you’ve changed and those you still need to add or commit
git commit -m <message> Commit changes to head (but not yet to the remote repository)
git log Show commit history. CommitId is the leading characters of the changeset ID, up to 10.
git checkout <branch> Checkout an exisitng branch
git remote add origin <server> Adds remote server so that project can be pushed.
git push add origin master Push the branch to your remote master repository
git pull Fetch and merge changes on the remote server to your working directory
git revert –no-commit <commitID>..HEAD Reverts the head to the specified commitID. All changes would not be lost, but will exist as unsaved changes in project.
Other useful GIT Links:

How to push Cloud9 project to GitHub: http://lepidllama.net/blog/how-to-push-an-existing-cloud9-project-to-github/

Great GIT tutorials: https://www.atlassian.com/git/tutorials/what-is-version-control

Posted by & filed under CheatSheets, Concepts, Web Development.

RESTful Routes

A table of all 7 RESTful routes

Name Path HTTP Verb Purpose Mongoose Method
Index /dogs GET List all dogs Dog.find()
New /dogs/new GET Show new dog form N/A
Create /dogs POST Create a new dog, then redirect somewhere Dog.create()
Show /dogs/:id GET Show info about one specific dog Dog.findById()
Edit /dogs/:id/edit GET Show edit form for one dog Dog.findById()
Update /dogs/:id PUT Update particular dog, then redirect somewhere Dog.findByIdAndUpdate()
Destroy /dogs/:id DELETE Delete a particular dog, then redirect somewhere Dog.findByIdAndRemove()