Monday 24 November 2014

Check if an array is multi-dimensional

if (count($array) == count($array, COUNT_RECURSIVE)) 
{
  echo 'array is not multidimensional';
}
else
{
  echo 'array is multidimensional';
}


http://stackoverflow.com/questions/145337/checking-if-array-is-multidimensional-or-not

Filtering data with PHP (Sanitizing data) and Validation

http://www.phpro.org/tutorials/Filtering-Data-with-PHP.html

http://code.tutsplus.com/tutorials/sanitize-and-validate-data-with-php-filters--net-259

http://www.sitepoint.com/input-validation-using-filter-functions/

To filter arrays:

http://stackoverflow.com/questions/19637210/post-variable-array-and-filter-input




http://php.net/manual/en/function.filter-input.php

http://php.net/manual/en/filter.constants.php

http://php.net/manual/en/function.filter-input-array.php

http://php.net/manual/en/filter.filters.php

http://php.net/manual/en/filter.filters.validate.php

Get url query string parameters using Javascript only

http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript

Difference between array merge and array + array

http://stackoverflow.com/questions/5394157/whats-the-difference-between-array-merge-and-array-array

Responsive Design: Screen resolution reference

http://spirelightmedia.com/resources/responsive-design-device-resolution-reference

Using rems

https://bugsnag.com/blog/responsive-typography-with-rems

http://snook.ca/archives/html_and_css/font-size-with-rem

CSS Clear Fix

http://perishablepress.com/lessons-learned-concerning-the-clearfix-css-hack/

Parallax websites

http://moz.com/blog/parallax-scrolling-websites-and-seo-a-collection-of-solutions-and-examples

Single Page Website

http://searchengineland.com/single-page-websites-seo-182506

Install both OpenJDK and Oracle Java on Fedora

Use the "alternatives" app to switch between the two.

http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/

Assign event to Escape keypress


$(document).keyup(function(e) {
  if (e.keyCode == 27) { some_code_here }   // esc
});

CSS 3 resize property

https://developer.mozilla.org/en-US/docs/Web/CSS/resize

https://developer.mozilla.org/samples/cssref/resize.html

Doesn't work on iframes in Firefox  33

Prevent link from doing default action

$( "a" ).click(function( event ) {
event.preventDefault();});
http://api.jquery.com/event.preventdefault/

Make link open in parent of iframe

window.parent.location.href= "http://www.google.com";

Saturday 8 November 2014

Restrict web site access to specific IP addresses in Apache

order deny,allow
deny from all
allow from 111.222.333.444

Put the above code in the .htaccess in the root. You can add more "allow from" lines for more ip addresses.

http://stackoverflow.com/questions/4400154/htaccess-deny-all-allow-only-one-ip

Friday 7 November 2014

Word wraping by word breaking

.break-word {
  word-wrap: break-word;
}

 http://webdesignerwall.com/tutorials/word-wrap-force-text-to-wrap