List git commits in terminal

Posted on Monday 2 January 2012

To get a pretty list of all your commit in your mac terminal use this command:

git log—pretty=format:”%h - %an, %ar : %s”

The list will look like this:

git commits

Read more →

What to do when you lost your administrator password to your mac

Posted on Wednesday 6 July 2011

I recentely had to get into a mac but I didn’t have the password to do that. All you need to do apparently is boot from the install cd you got with your mac and choose reset password from the menu where you can also find the disk utility.

Read more →

How to hide the facebook Like count

Posted on Wednesday 6 July 2011

What I do, is put a div on top of the like count which is absolutely positioned

Facebook like

THE CSS

.facebook_like{
position: relative;
float:left;

.facebook_like_hide_count{
width: 50px;
height: 20px;
background: white;
position: absolute;
left: 50px;
top: 0;
}

THE HTML

<div class="facebook_like">  
<fb:like href="http://yoururl.com/" send="false" layout="button_count" width="20" show_faces="true" font=""></fb:like>
<div class="facebook_like_hide_count"> </div>
</div>

Read more →

How to get the youtube ID from a youtube URL

Posted on Friday 11 February 2011

Use this function ;)

function get_youtube_id_from_url($url)
{   
     preg_match('/youtube\.com\/v\/([\w\-]+)/', $url, $match);
     return $match[1];    
}

Read more →

Extract the source from an img tag with PHP

Posted on Friday 11 February 2011

You can extract the source from an img tag with this PHP function:

function get_src_from_img($string){
     if (preg_match('/
         return $arrResult[1];  // Should display http://path.to/img
     } else {
         return "No src found";
     }
}

Comes in handy with wordpress sometimes.

Read more →

Simulate iPad browser in Safari

Posted on Friday 11 February 2011

First of all you need to enable the developer menu in Safari. To do that you need to launch the terminal and enter the following command into it. Be sure to type it in exactly because it's case sensitive:

defaults write com.apple.Safari IncludeInternalDebugMenu 1

Press enter and relaunch safari. A new menu item should be available to you. If for some reason something were to go wrong just retype the command in the terminal and end with a "0" instead of a "1".

Then go to the develop menu -> user agent and choose other. Then you need to type in the user agent string. For iPad the string is:

Ipad user agent

Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10

Hit return and your browser should now emulate an iPad browser.

Read more →