Creative ideas have to be shared, copied and adapted!
Day quote…
  • The important thing in science is not so much to obtain new facts as to discover new ways of thinking about them Sir William Bragg

Delete files with a pattern recursively using the terminal

terminal

This is just a simple way to delete files recursively using your terminal in any UNIX-like operating system:

Explanation

-name “FILES_PATTERN” : File pattern.
-exec rm -rf {} \; : Delete all files that match the file pattern.
-type f : Not include directories.

How to know if a user is authenticated or not in WCM 8 and 8.5

Lock-simple-128

This is pretty simple way to check if any user has a session started or not; this is useful in cases where you want to display or execute an specific code depending on the user session. To create this kind of validation we can take advantage of the WCM plugins Equals and NotEquals

 

Update Node.js using the terminal

nodejs-logo

These are just the steps to update Node.js by using your terminal:

The n package represents a Node helper, and running this command upgrades node to the latest stable version.

Just to confirm we can check our version:

 

 

Uncommon Sense by Derek Sivers

pensador-rodin

A great talk about how a business can evolve, from being just an idea to become a millionaire business.

If you have an amazing idea but no execution, it’s not worth anything. You haven’t done anything. It’s worthless.

If you had a good idea and you’ve actually gone and made it happen in a pretty good way, you could maybe make a million dollars. And if you have an amazing idea, and you have an amazing team and you do great execution, you could maybe make 20 million dollars.

Derek Sivers in Uncommon Sense – live @ WDS

Logging detailed error messages when running Gulp.js tasks

gulp
Gulp.js has become one of the most used task managers nowadays. But sometimes, when running several tasks with many pipes( ) on them, it is very difficult to understand what’s wrong or the actual reason why our task is not working as expected. For others like me, who like to have a better error description, here is what needed to do:
Install Gulp Util
Import the Gulp Util by using the following statement:
Finally, in your pipes, add a new “event” to manage the “error”, e.g. when you are uglifying your code, here is how you can attach the error handler of gulp util:

Notice the “on(‘error’)” part, that is where the magic happens.

Hope you find this top useful, see you next time!

Could not open input file: composer.phar error in Symfony 2. SOLVED.

php-elephant

This is a common issue that is related with a bad installation of our favoritte PHP package manager: Composer. Let’s fix it:

Open your terminal and run following comand in order to get the latest version of Composer:

I recommend you to move the composer.phar file to a global “bin” directoy, in my case (OS X) the path is:

Create an alias for easy access:

If everything is ok, now it is time to verify our Composer version:

That’s it! Start making great Symfony 2 projects 🙂

My personal .gitignore file

github

Lesson learned

After doing this file many times, I decided to build my personal .gitignore file; I use to add it in my very fist commit as a good practice in every single git repository I create.

Currently we are ignoring:

  • Operating systems’ temporary files: Mac OS X, GNU/Linux, Windows.
  • IDEs and editors’ configuration: Vim, Sublime Text, Notepad++, Eclipse, Netbeans, Xcode, IntelliJIDEA.
  • Other Control Version Systems: CVS, SVN

More information about ignoring files: https://help.github.com/articles/ignoring-files

Note: if you want to create your own configuration in your .gitignore you could use: http://www.gitignore.io/

How to integrate this file into my project

  • Download or copy following file/content in the root directory of your project with the name .gitignore (gitignore.txt)
  • If you download gitignore.txt file, please rename it to .gitignore

    Common issue: “OS X doesn’t let me to rename my gitignore.txt to .gitignore”:

    “You can’t use a name that begins with a dot “.”, because these names are reserved for the system. Please choose another name”.

    A workaround for this is to:

    1. Open the terminal
    2. cd to the directory with gitignore.txt and run the following command
    3. mv gitignore.txt .gitignore
  • Add .gitignore file to your repository (git add)
  • Commit (git commit)
  • Upload your commit to remote server (git push)

REMEMBER!

Once Git starts to watch/track any file, for example hello.txt in the repository, it is NOT possible to say “Hey git! now, ignore my file hello.txt“. Unless you read this post: How to force Git to “ignore” tracked files.

Hope you find this .gitignore useful, see you next time!

How to force Git to “ignore” tracked files

git-icon

Well, well, well, you decided to start with the most incredible version control system: Git; you made your repository, start adding some commits, life was great! But suddenly, your realize there are some configuration files that started to be tracked by Git, because you forgot to add the famous .gitignore file.

Deleting those files is not an option because you need them, but those files are only interested/required for you, not for other team members. After researching a little bit, many people say there is no way to “ignore” files once there are been added to the repository; but don’t worry that is not totally true, there is a way to do that, let’s see it:

Remove the file from the index

Commit this “removed” operation

Add this file to the .gitignore and commit it

Edit the .gitignore file to include this new “ignored” file/folder:

That’s it for today! Enjoy your day 🙂

How to do a “checkout” of a remote git branch

git-icon

Let’s face it, everyone that loves technology, web development or any IT-related stuff works in teams, the old concept of a programmer/developer alone in his basement is not part of our life anymore, so; the usage of a version control system is a must. As you probably know, I am big fan of what I consider the best VCS, of course, I am talking about: Git (Is there something else?).

What I really enjoy is working in a customized terminal like iTerm + Fish Shell, that couple is simply awesome! But… sometimes using remotes, branches, workflows can be a litter intimidating, like today: one of my colleagues asked me the simplest way to get a copy (checkout) of any remote branch from a git repository, so, here is my answer:

That’s it for today, enjoy and be happy with your repo 🙂

Alex Arriaga