Skip to content

Instantly share code, notes, and snippets.

@QuestionDevelopment
QuestionDevelopment / set file and folder permissions
Created August 23, 2013 19:54
set file and folder permissions
find /var/www/ -type d -not -iwholename '*.svn*' -print0 | xargs -0 chmod 755
find /var/www/ -type f -not -path '*.svn*', -not -path '*.ssh*', -not -iwholename '*.sh*' -print0 | xargs -0 chmod 644
@QuestionDevelopment
QuestionDevelopment / mouseover hand
Created August 23, 2013 19:55
Change the cursor to a hand - WORKS IN FIREFOX
onmouseover="this.style.cursor='pointer';"
function IsEmpty(aTextField) {
if ((aTextField.value.length==0) ||
(aTextField.value==null)) {
return true;
}
else { return false; }
}
@QuestionDevelopment
QuestionDevelopment / form validation onsubmit
Created August 23, 2013 19:56
allow for form validation without leaving page
<script language="JavaScript" type="text/javascript">
<!--
function CheckForm() {
if (!(document.contactForm.name.value.length > 0))
{
alert("You must enter your Name");
contactForm.name.focus();
return false;
}
function getCSSRule(ruleName, deleteFlag) { // Return requested style obejct
ruleName=ruleName.toLowerCase(); // Convert test string to lower case.
if (document.styleSheets) { // If browser can play with stylesheets
for (var i=0; i<document.styleSheets.length; i ) { // For each stylesheet
var styleSheet=document.styleSheets[i]; // Get the current Stylesheet
var ii=0; // Initialize subCounter.
var cssRule=false; // Initialize cssRule.
do { // For each rule in stylesheet
if (styleSheet.cssRules) { // Browser uses cssRules?
cssRule = styleSheet.cssRules[ii]; // Yes --Mozilla Style
<select
onchange="if(!options[selectedIndex].defaultSelected)
location='http://www.URL.com/page.asp?value='+options[selectedIndex].value">
<option value="1">option 1</option>
<option value="2">option 2</option>
<option value="3">option 3</option>
<option value="4" selected="selected">option 4</option>
<option value="5">option 5</option>
</select>
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Greg Burghardt | http://www.geocities.com/greg_burghardt/ */
var _GET = {};
function readURL() {
var tLoc = "", tPairs = "";
var tGet = [];
var foundGet = -1;
tLoc = window.location + "";
<!-- Script by hscripts.com -->
<!-- copyright of HIOX INDIA -->
<!-- Free javascripts @ http://www.hscripts.com -->
<script type="text/javascript">
checked=false;
function checkedAll (frm1) {
var aa= document.getElementById('frm1');
if (checked == false)
{
checked = true
if($_SERVER["REQUEST_METHOD"] == "POST") {
@QuestionDevelopment
QuestionDevelopment / remove all returns
Created August 23, 2013 20:04
Gets rid of all types of hard spacing returns/tabs ect.
str_replace(array("\r\n", "\r", "\n", "\t"), "<br />", htmlentities(nl2br($hover_display)));