Nisi’s work blog

Nisi’s work blog – programing tips

jQuery Visual Cheat Sheet

If you are like me you “learn from walking” (learn something in time you write a script, an application ). jQuery is a great framework but it become so big that sometimes you can not remember all methods, selectors and basically every stuff  implemented there to make your work easy.

For this there are Cheat Sheet free PDF’s. This is made for jQuery 1.4.2 but easily can be used with all cheat sheet versions.

Download jQuery Visual Cheat Sheet from uploading.com (Free PDF)

Designed by Antonio Lupetti this pdf is realy a 4 pages gold book.

Post Source: http://woorkup.com/ (find there more Cheat Sheets and more)

jQuery, disable right click browser menu

When working on complex applications with jQuery you get to a point where you need to have your own right click menu.

You have the options to disable entire page right click menu or just for a div.

Disable for the entire document:

  1. $(document).ready(function()
  2. {
  3.        $(document).bind("contextmenu",function(e){
  4.               return false;
  5.        });
  6. });

Disable for a div:

  1. $(document).ready(function()
  2. {
  3.        $(‘#my_div’).bind("contextmenu",function(e){
  4.               return false;
  5.        });
  6. });

jQuery, check witch mouse button had been pressed

The .click is great, but witch button had been pressed?

  1. $(document).click(function(e) {
  2.    if ((e.button == 0)  && (e.button == 1)){
  3.       // was the left button pressed
  4.       alert(‘clicked’);
  5.    }
  6.    if (e.button == 3){
  7.       // was the right button pressed
  8.       alert(‘click’);
  9.    }
  10. });

How to display all Global variables in PHP

Sometimes when debugging an application you need to see all global variables.

In PHP there is an easy way:

  1. $defined_vars = get_defined_vars();
  2. print_r($defined_vars);

Make your own website toolbar

Have you seen that almost every website have a toolbar? Why? Because with a toolbar designed for a specific website you can get your visitors to return every time you update your toolbar and your site.

Now you can start looking on toolbar tutorials start design one, working hours an hours on debugging and programing and debugging and …

Or … you can get an already available toolbar put your website or application logo put an rss or other already available gadgets and start promoting it. And if you cant find what you need use the toolbar API, html and flash to build what you have in mind.

And yes it is free and more you can make money with it when people download your toolbar.

Lets see some images:

And the money :

Where you can get this toolbar? At Conduit: http://www.conduit.com

Wordpress templates function Cheat Sheet

If you are a beginner in creating themes for WordPress, or you just need to remind you from time to time wordpress theme related functions, the pdf  “Wordpress Cheat Sheet” is for you. It contain all functions needed for creating a wp theme like in the preview picture below.

PDF was made by Ekin Ertaç and can be downloaded for free from the http://ekinertac.com/?p=259 webpage or from Uploading.com by clicking here.

Source: http://ekinertac.com

Preview your website in iPad

iPad is out. Now a good question for webmasters and website developers came. How my website is rendered on iPad.

You dont need to buy an iPad for this, there is a free service witch render your site like in iPad.

Included iPad like keyboard, normal and lendscape view. (Click on the top iPad border to rotate). Flash is not supported on real iPad. This will support so if you want the real iPad render you should disable flash on your browser.

http://ipadpeek.com/

New Line in PHP

Printing a new line witch is visible in a web page is made like this:

  1. echo(‘line 1′.\n.‘line 2′);
  2.  

the code above will print line 1 on a line and line 2 on a new line.

Now if you have to generate a CSV file  <br/> wil not work  you have to use  \n like in C language but there is a trick.

  1. echo (‘line 1 \n line 2′); //will print something like    line 1 \n line 2
  2. echo("line 2 \n line 2")// will print line 1 on the first line and line 2 on the second line

double quotes will parse \n as a new line and single quotes will believe is is a text

Wordpress: get the role of the current user

  1. /* get the role of the current user */
  2. global $current_user, $wpdb;
  3. $var = $wpdb->prefix . ‘capabilities’;
  4. $caps = $current_user->$var;

Open Source Video Conferencing

Every project where people from different location are involved need a Video Conferencing solution. Usualy phone or video calls are used but what you do if you need to have a presentation for some charts or some source code? Then you buy or rent video conferencing services.

Now there is an open source alternative and it came with the name BigBlueButton.The application enables multiple users to login and share their webcam or communicate via VOIP at the same time, upload office documents or keep everyone in sync with their current page and mouse pointer

More about BigBlueButton on http://bigbluebutton.org/

Some video Overview: http://bigbluebutton.org/content/videos (they say then one image are equivalent to 1000 words and there are 5 movies so … )