Skip to content

Instantly share code, notes, and snippets.

View fkumro's full-sized avatar
💭
Elixir

Frank Kumro Jr fkumro

💭
Elixir
View GitHub Profile
<?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();
<?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
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
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
$this->load->helper('recaptcha');
?>
<Plugin Cache>
<backend>
class Cache::Memcached
servers [127.0.0.1:11211]
</backend>
</Plugin>
@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;
@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 / gist:953982
Created May 3, 2011 19:05
catalyst_testing_tutorial
use strict;
use warnings;
use Test::More tests => 1;
use lib 't';
use Mock::Cache; #example of mocked object needed later
BEGIN { use_ok 'MyApp::Model::Books' }
@fkumro
fkumro / SublimeConfig
Created July 18, 2012 14:56
My Sublime Text 2 User Configuration
{
"color_scheme": "Packages/User/Tomorrow-Night.tmTheme",
"caret_style": "phase",
"default_line_ending": "unix",
"font_size": 11,