Skip to content

Instantly share code, notes, and snippets.

View walterdavis's full-sized avatar

Walter Lee Davis walterdavis

View GitHub Profile
var list = $$("#yourDataTable tr");
var filter = $('yourFilterField')
list.each(function(elm){
elm['keys'] = elm.innerHTML.stripTags().toLowerCase();
});
var lastValue = $F(filter);
filter.observe('keyup', function(e) {
var value = this.value.toLowerCase();
if (value !== lastValue) {
list.each(function(elm) {
<?php
define('MYACTIVERECORD_CONNECTION_STR', 'mysql://username:password@localhost/databasename');
require_once('MyActiveRecord.php');
class User extends MyActiveRecord{
//this model will "wrap" a database table named exactly 'user'
//and having an auto-incrementing primary key named 'id'
//extend base model methods here
function save(){
//mandatory checkbox
function toggleInputs(){
//replace the placeholder names below
var inputs = $('theNameOfYourSecondaryBox').select('input,select,textarea');
var checkbox = $('theIdOfYourCheckbox');
//all the rest of this can stay the same
if(checkbox.checked){
inputs.invoke('disable');
}else{
inputs.invoke('enable');
}
<item-action name="com.wdstudio.MyActionViewHelper" title="MyActionViewHelper">
<action-version version="0.1">
“MyActionViewHelper” Action
Walter Davis Studio 2010
</action-version>
<action-file var name="partial" keepwithhtml>
<action-checkbox title="Move Form Into Partial" name = "addform" default=no/>
<action-text var name="before" />
<action-text var name="after" />
<action-checkbox title="Remove IDs" name = "removeIds" default=no/>
//Light2box ©2010 Walter Davis Studio
if(! $('page_overlay')){
//create the overlay
var overlay = new Element('div',{id:'page_overlay'});
$$('body').first().insert(overlay);
overlay.setStyle('position:fixed; height:100%; width:100%; background: rgba(0,0,0,0.7) url(/images/ajaxloadreverse.gif) no-repeat center 150px; top:0;left:0; z-index:1000; display:none;');
//pretend that IE is a worthwhile browser
if(Prototype.Browser.IE){
overlay.setStyle('position:absolute; background:url(/images/ajaxloadreverse.gif) no-repeat center 150px; -ms-filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#B2000000,endColorstr=#B2000000); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#B2000000,endColorstr=#B2000000); zoom: 1;');
var h = document.viewport.getScrollOffsets()[1];
var box = $('item9');
var tabs = box.select('h3');
var bodies = box.select('p');
var tab_color = '#ccc';
var selected = '#dd9';
tabs.invoke('setStyle','display:inline; padding:4px 8px; background-color:' + tab_color + '; margin:0; cursor:pointer');
bodies.each(function(elm){
elm.hide();
elm._tab = elm.previous('h3');
box.insert({bottom:elm.remove()});
<?php
if( isset( $_POST['password'] ) ){
$input = trim(strip_tags($_POST['password']));
header('Location: http://example.com/' . $input );
exit;
}
?>
<%
' Website Contact Form Generator
' http://www.tele-pro.co.uk/scripts/contact_form/
' This script is free to use as long as you
' retain the credit link
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6/prototype.js"></script>
<script type="text/javascript" charset="utf-8">
// <![CDATA[
document.observe('dom:loaded',function(){
document.observe('keypress', function(evt){
var current_selection = false;
//somewhere in your selection code, set this to
//true when you have marked a selection
// ...
current_selection = true;
var getKeyCode = function(evt){
var code;
if (evt.keyCode) code = evt.keyCode;
else if (evt.which) code = evt.which;
return parseInt(code,10);