Rating
+1.13
Votes:
1
avatar

Web Development  

CSS file that resets browser defaults

CSS file that resets browser defaults:



html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-size: 100%;
	vertical-align: baseline;
	background: transparent;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}

/* remember to define focus styles! */
:focus {
	outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
	text-decoration: none;
}
del {
	text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
	border-collapse: collapse;
	border-spacing: 0;
}




Via Meyerweb

[cfwheels] Apache with Tomcat and url rewriting

Hell YES. This ^&(%^989&^%*(% Tomcat is now working for me like a bleeding
pig. Hell YES!!! 12 hours of making this shit working. I am dying :F

I haven't found anywhere instruction so I put this in here

Assumption data:

— site folder is f:/usr/htdocs/cfpages/site
— site folder is accessible by the Apache
— our site is localFirstCFWheels
— no mod_jk no mod URLFilter or how this shit is called
— pure apache rewrite rules
— Apache Tomcat 6.0.26 Server
— Apache 2.2.13 (and later)
— Railo 3.1.2.001
— Apache Tomcat is configured to listen on 8100 port



( Read more )

Guest machine for Virtualbox with preinstalled Django, Pylons and Ruby On Rails

This weekend I have devoted my time for playing with the new and famous frameworks Django, Pylons, and Ruby On Rails.
Almost 80% of the weekend I spent on installing them, if you don't wanna spend time by installing these frameworks and want start playing with them immediately, you are welcome to use my already configured virtual machine for Virtualbox.

First of all you will need Virtualbox, then download image of my virtual machine:
Server 1
Server 2

Extract the archive and import the virtual appliance to Virtualbox
Importing Guest Machine



( Read more )

CSS hacks

/***** Selector Hacks ******/
 
/* IE6 and below */
* html #uno { color: red }
 
/* IE7 */
*:first-child+html #dos { color: red }
 
/* IE7, FF, Saf, Opera */
html>body #tres { color: red }
 
/* IE8, FF, Saf, Opera (Everything but IE 6,7) */
html>/**/body #cuatro { color: red }
 
/* Opera 9.27 and below, safari 2 */
html:first-child #cinco { color: red }
 


( Read more )

print_r for Javascript


function print_r(theObj){
  if(theObj.constructor == Array ||
     theObj.constructor == Object){
    document.write("<ul>")
    for(var p in theObj){
      if(theObj[p].constructor == Array||
         theObj[p].constructor == Object){
document.write("<li>["+p+"] => "+typeof(theObj)+"</li>");
        document.write("<ul>")
        print_r(theObj[p]);
        document.write("</ul>")
      } else {
document.write("<li>["+p+"] => "+theObj[p]+"</li>");
      }
    }
    document.write("</ul>")
  }
}

Get current URL in PHP


<?php
function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
?>


Test example:

<?php
  echo curPageURL();
?>


Source

Allow your web site for specific IP addresses using .htaccess

Hello All,
Here is small note, how to allow specific IP addresses to be accessed to your website by using .htaccess,
you may need it while maintenance website.
By assuming your hoster allows using .htaccess
all of you need it is create file named .htaccess
copy paste the code bellow (note some servers want the file be utf-8 encoded otherwise you will get 500 error)
replacing to your actual IPs.


        RewriteEngine on
	RewriteCond %{REMOTE_HOST} !^192\.168\.  #any ip from 192.168.0.0 to 192.168.255.255
	RewriteCond %{REMOTE_HOST} !^192\.190\.1\.86 #just some IP that will be allowed too
	RewriteCond %{REQUEST_URI} /.*$ 
	RewriteCond %{REQUEST_URI} !/maintenance\.html$ #users that aren't allowed will see this page
	RewriteCond %{REQUEST_URI} !(css|png|jpg)$ # if maintenance.html consists images, you have to allow them either.
	RewriteRule .* maintenance.html [R=301,L]


Also you can block users by IP, by changing a little the rules above.

30+ PHP Best Practices for Beginners – Basix

1. Befriend the PHP Manual
If you're new to PHP, then it's time to get acquainted with the awesomeness that is the PHP manual. The PHP manual is incredibly thorough and has truly helpful comments following each article. Before asking questions or trying to figure out an issue on your own, save some time and just head straight to the manual. Odds are the answer to your question is already nestled in a helpful article at the PHP.net site. Read more..