Skip to content

Instantly share code, notes, and snippets.

View fkumro's full-sized avatar
💭
Elixir

Frank Kumro Jr fkumro

💭
Elixir
View GitHub Profile
@fkumro
fkumro / webpy_sample_app.py
Created March 23, 2011 18:25
webpy sub applications
import web
from controllers import blog
urls = (
'/blog', blog.app
)
app = web.application(urls, locals())
if __name__ == "__main__":
@fkumro
fkumro / catalyst_debug_quiet.pl
Created February 22, 2011 15:00
Keeping Catalyst quiet unless in debug mode
__PACKAGE__->log->levels( qw/info warn error fatal/ ) unless __PACKAGE__->debug;
<Plugin Cache>
<backend>
class Cache::Memcached
servers [127.0.0.1:11211]
</backend>
</Plugin>
<?php
$this->load->helper('recaptcha');
?>
<?php
function recaptcha_check($response)
{
// check to see if the recaptcha is correct
$resp = recaptcha_check_answer (
$this->_recaptcha_private_key,
$this->input->ip_address(),
$this->input->post('recaptcha_challenge_field'),
$this->input->post('recaptcha_response_field'));
if(!$resp->is_valid)
<?php
function someAction()
{
$this->load->library('form_validation');
// set validation rule for the recaptcha response
$this->form_validation->set_rules('recaptcha_response_field', 'reCaptcha', 'required|callback_recaptcha_check');
if ($this->form_validation->run() === FALSE)
{
// store the recaptcha html code for the view
$data['recaptcha'] = recaptcha_get_html($this->_recaptcha_public_key);
<?php
// store your private/public key
private $_recaptcha_private_key = 'YOUR PRIVATE KEY GOES HERE';
private $_recaptcha_public_key = 'YOUR PUBLIC KEY GOES HERE';
?>
<?php
class Test extends Controller
{
// store your private/public key
private $_recaptcha_private_key = 'YOUR PRIVATE KEY GOES HERE';
private $_recaptcha_public_key = 'YOUR PUBLIC KEY GOES HERE';
function __construct()
{
parent::__construct();