Hair Care Tips

For at least the last 10 years, I’ve been doing what probably most guys do when it comes to hair care – the bare minimum. We use a 2-in-1 shampoo and conditioner to save time, quickly towel dry our hair, comb it and we’re done. And we do that every day. While that may seem like an innocent process, it turns out it can easily damage your hair resulting in dry, tangled, and/or frizzy hair at best. Personally, I noticed that my hair became very dry and frizzy. It also felt rough and tangled when I’d run a comb or my fingers through it. And for some reason, the front section was in worse condition than the rest. So, I decided to figure out WTF was going on and try to repair my hair since, apparently, I was unknowingly damaging it. Below are some tips that have made a big difference for me. The products below are used in the order listed.

1. Silk Pillowcase

i used to use a regular cotton pillowcase but now I use a silk one. When you sleep, your hair is constantly in contact with your pillow so having a pillow made of a super soft and silky fabric will help lessen any roughness done to your hair as you lay your head and turn around while you sleep. Plus, silk feels very good on your skin and especially your face. The pillowcase I bought is Spasilk 100% Pure Silk Facial Beauty Pillowcase which costs $20. With a 4 star rating from 764 customer reviews, apparently many other people like it as well.

Continue reading Hair Care Tips

Reverse-Merging / Rolling Back a Revision in Cornerstone

To roll back (undo) a specific revision in Cornerstone, select the Advanced Merge tab and compare the revision you want to roll back against the revision you want to roll back – 1. For example, if you want to roll back revision 22570, compare it against revision 22569 as shown in the screenshot below.

cornerstone-reverse-merge

Continue reading Reverse-Merging / Rolling Back a Revision in Cornerstone

Create SSL Certificate with SANs (Subject Alternative Names)

When you’re developing websites at work, while you can set up a self-signed certificate to test pages over SSL, it’s better to use a trusted certificate which you can do for free if your employer has set up a CA certificate which you can sign against. Also, since certificates are only valid for one level of a domain, e.g. abdullahyahya.com is different from foo.abdullahyahya.com which is different from foo.bar.abdullahyahya.com, you can add Subject Alternative names to your certificate and wildcards like *.abdullahyahya.com, *.foo.abdullahyahya.com and *.foo.bar.abdullahyahya.com to use the same certificate over many domains.

Following are steps to set up a certificate with SANs on a Mac with Apache.

1. Install OpenSSL

$ brew install openssl

Continue reading Create SSL Certificate with SANs (Subject Alternative Names)

Clean Glass, Mirrors, Plastic, Faucets and Many Other Surfaces with Vinegar

Recently I needed to clean my glass coffee table so, as most people would do, I sprayed on some glass cleaner solution and used a paper towel and began wiping the table. For some reason, I noticed a LOT of streaks on the glass and there was some kind of white rough residue all over the table. I thought it was because I used a cheap glass cleaner solution but wasn’t sure. After doing a bit of research, I was surprised to find that simple vinegar and water does a better job at cleaning glass. There’s a little more to it though so here are instructions:

Continue reading Clean Glass, Mirrors, Plastic, Faucets and Many Other Surfaces with Vinegar

Chrome Inspector: Editing and Debugging Javascript

Debugging Javascript can be tricky. But, thanks to Google Chrome’s Inspector, it’s not so bad. You can edit your Javascript files directly in Chrome’s Inspector and run the code to quickly test and fix problems. Here’s how to do it.

1. Open a page that has Javascript included in a separate file. This example uses the website http://www.yourhtmlsource.com/javascript/basicjavascript.html.

js-debug-1

Continue reading Chrome Inspector: Editing and Debugging Javascript

Optimize a PDF for Smaller File Size

The file size of PDFs can get large when you start adding a bunch of images and have lots of pages. To optimize and reduce the file size as much as possible, open the PDF in Adobe Acrobat Pro, click Save As, and choose “Adobe PDf Files, Optimized (*.pdf)”. This reduced one test PDF from 7.18 MB to 4.22 MB.

pdf-optimized

Edit, Sign, & Remove Restrictions of Any PDF Document

If you want to edit or sign a PDF file but can’t due to restrictions placed on it, you can unrestrict the PDF by first uploading the PDF to Google Drive, and then opening the Google Drive PDF in DocHub.

pdf-tax-return
Cannot edit PDF (see red box)

google-drive-upload
Upload restricted PDF to Google Drive

open-dochub
Open in DocHub

dochub-sign
You can sign and do many edits in DocHub such as apply whiteout, redact text, etc.

save-pdf
Save as “unrestricted” PDF from DocHub

Simple Git Workflow

If you want to version some files like a website project you’re working on, Git works really well. No remote server is needed and everything is self-contained by folder.

  1. Create a new, empty folder
  2. Run git init (a hidden .git subfolder will get created which will store all versioning information this new repository)
  3. Create a file, e.g. test.txt, write “line 1” in it and save it.
  4. Run git status (you’ll see one untracked / unversioned file)
  5. Run git add text.txt or git add . (test.txt or all files within the current directory will get added / staged for committing)
  6. Run git status (you’ll see text.txt is ready to be committed)
  7. Run git commit -m “Added one line” (text.txt will get committed)
  8. Run git status (you’ll see that there’s nothing ready to commit and the working directory is clean)
  9. Edit the file and write “line 2” on line 2 and save it
  10. Run git status (the file will status will be “modified”)
  11. Run git checkout — test.txt (the changes  – line 2 – will be reverted / undone)
  12. Edit the file again and write “line 2” on line 2 and save it
  13. Run git add . followed by git commit -m “added line 2” (the modified file is added and committed)
  14. Run git log (a log of all commits included commit messages and signatures is displayed)

C:\Users\ayahya\Documents\temp>git log
commit 78f7d5cd1f9cbec2cc7a55a3e5cd6dd12b2ea13d
Author: unknown <ayahya@100739-T440.corp.qualys.com>
Date: Fri Mar 20 16:29:39 2015 -0700

added line 2

commit 2587182fe50b7f1ae01b3153f637fd3abcbe2120
Author: unknown <ayahya@100739-T440.corp.qualys.com>
Date: Fri Mar 20 16:13:46 2015 -0700

Added one line

  • Run git diff 78f7d5cd1f9cbec2cc7a55a3e5cd6dd12b2ea13d 2587182fe50b7f1ae01b3153f637fd3abcbe2120 (and you’ll see a standard diff between the two commits)
  • If you want to move your repo to another folder or computer, just copy the whole folder containing the hidden .git subfolder.

For more info, visit the Git documentation or this ebook.

For a visual understanding of Git, check this out.

Learn more about the diff format

Adobe Illustrator: Fitting Artboard to Object

When working with Adobe Illustrator, many times you’ll find that the objects that you want to save as a JPG or SVG are on an artboard that is larger than the size of the object. If you save the the artwork, the object including the whitespace around it up to the borders of the artboard are saved. This is usually not what you want. If you want to save just the object, you need to resize the artboard to fit the borders of the object.

Below, you’ll see the artboard is bigger than the object (I clicked on View > Outline to show an outline of the object).

illustrator-artboard-crop-1

Click the artboard tool (Shift-O) and position your mouse cursor over the object and then double-click.

illustrator-artboard-crop-2

This will crop the artboard to fit the size of the object.

illustrator-artboard-crop-3

UPDATE: Actually, there’s an easier way. Just select the art work then choose Object > Artboards > Fit to Artwork Bounds.

Fix Patch Error – patch unexpectedly ends in middle of line

I was patching a file with a patch file containing all adds (+). If should have been straightforward but I got the following error.

bash-3.2$ patch –unified –batch –ignore-whitespace -p0 -V never -r /dev/null < /4109.patch
patching file /index.html
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 127:

bash-3.2$

There’s an empty line  after the colon which is suspicious. I opened the patch file and added a line break at the end of the file, reran the patch command and it worked.

If this happens to you, try adding a line break at the end of your patch file. Stupid, as hell, I know, but it worked 🙂