Skip to content

Instantly share code, notes, and snippets.

View walterdavis's full-sized avatar

Walter Lee Davis walterdavis

View GitHub Profile
/**
* Evaluates current object property by means of a comparison operator (< > == etc.) against a provided value.
*
* @param string $strKey Property name
* @param string $strComparisonOperator A comparison operator, < > == etc.
* @param string $strComparisonValue The value to compare with
* @param string $strErrorMessage (optional) a meaningful error message
* @return boolean
*/
function validate_comparison($strKey,$strComparisonOperator,$strComparisonValue,$strErrorMessage=null){
if(isset($_POST['save'])){
$person->populate(clean($_POST));
$person->save();
if(!$person->get_errors()){
//everything has been saved
//send two mail messages
mail(ADMIN_EMAIL,'New contact from the Web site',print_r($person,true),'From: ' . ADMIN_EMAIL,'-f' . ADMIN_EMAIL);
mail($person->email,AUTOREPLY_SUBJECT,AUTOREPLY_MESSAGE,'From: ' . ADMIN_EMAIL,'-f' . ADMIN_EMAIL);
//redirect
header('Location: ' . THANKS_PAGE);
Event.observe(window,'load',function(){
var select = (window.location.href.indexOf('?') > -1) ? window.location.href.split('?')[1] : '';
var my_glider = new Glider("carousel_item1", {duration:0.5, initialSection: select});
$$('.carousel_item1.next').each(function(elm){
elm.observe('click',function(evt){
Event.stop(evt);
return my_glider.next();
});
});
$$('.carousel_item1.previous').each(function(elm){
Event.observe(window,'load',function(){
var select = (window.location.href.indexOf('?') > -1) ? window.location.href.split('?')[1] : '';
var my_glider = new Glider("carousel_item1", {duration:0.5, initialSection: select});
var my_glider2 = new Glider("carousel_item2", {duration:0.5, initialSection: select});
$$('.carousel_item1.next').each(function(elm){
elm.observe('click',function(evt){
Event.stop(evt);
my_glider2.next();
return my_glider.next();
});
Event.observe(window,'load',function(){
var select = (window.location.href.indexOf('?') > -1) ? window.location.href.split('?')[1] : '';
var my_glider = new Glider("carousel_item1", {duration:0.5, initialSection: select});
var my_glider2 = new Glider("carousel_item2", {duration:0.5, initialSection: 'theIdOfTheLastPane'});
$$('.carousel_item1.next').each(function(elm){
elm.observe('click',function(evt){
Event.stop(evt);
my_glider2.previous();
return my_glider.next();
});

A Note

Forking has been fixed, but the old repositories will still be corrupted.

Basics

The method page will create a new page: page "home" do "Hello, world!"

Testing a remote gist
var Marquee = Class.create({
initialize: function(element) {
this.element = $(element);
this.paused = false;
// If everything fits don't bother with all this mess
if(this.element.scrollWidth == this.element.clientWidth) return;
// Defaults to scrolling through all content in 40 seconds.
$out = preg_replace_callback('/<pre>[\s\S]+?<\/pre>/m','strip_breaks_callback',$out);
$out = preg_replace_callback('/<table.*?>[\s\S]+?<\/table>/m','strip_breaks_callback',$out);
$out = preg_replace_callback('/<div class="code">[\s\S]+?<\/div>/m','strip_breaks_callback',$out);
$out = preg_replace_callback('/<ol>[\s\S]+?<\/ol>/m','strip_breaks_callback',$out);
$out = preg_replace_callback('/<ul>[\s\S]+?<\/ul>/m','strip_breaks_callback',$out);
<a name="fb_share" type="icon_link" share_url="www.example.org"></a>