Skip to content

Instantly share code, notes, and snippets.

sudo -u apache ssh-keygen -t rsa
//make sure ./.ssh dir is set to 770
function URLEncode (clearString) {
var output = '';
var x = 0;
clearString = clearString.toString();
var regex = /(^[a-zA-Z0-9_.]*)/;
while (x < clearString.length) {
var match = regex.exec(clearString.substr(x));
if (match != null && match.length > 1 && match[1] != '') {
output += match[1];
x += match[1].length;
@QuestionDevelopment
QuestionDevelopment / find delete svn folders
Created August 23, 2013 19:53
Find and delete svn folders
find ./ -name .svn -exec ls -l {} \;
find ./ -name .svn -exec rm -rf {} \;
@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';"
@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 changeBG(theid){
if(theid.style.backgroundImage == 'url(images/expand.jpg)') {
var your_image = 'images/collapse.jpg';
theid.style.backgroundImage="url('"+your_image+"')";
}
else {
var your_image = 'images/expand.jpg';
theid.style.backgroundImage="url('"+your_image+"')";
}
}
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
function return_agent(theForm) {
var radioSelected = false;
for (i = 0; i < theForm.agent_id.length; i++)
{
if (theForm.agent_id[i].checked)
radioSelected = true;
}
if (!radioSelected)
{