Skip to content

Instantly share code, notes, and snippets.

<?
/*
*
*
* ----- Please note, my syntax is constantly evolving as I type this out
* ----- This really is a 10% done thing, in it's conception.
* ----- By the time you're reading this, i've probably changed
* ----- around the code a bit, but it should give you a general
*- ---- idea
<button class="replybutton" data-origional="123" data-parent="123">Reply</button>
<script>
$('.replybutton').on('click', function(){
$(this).addClass('loading'); // a class that adds a no-repeat right-aligned background of a spinning giff... give it some padding so it appears 'in the button'.
if ($(this).is(":visible")) {
$("#post" + $(this).data("parent")).slideUp();
} else {
$("#post" + $(this).data("parent")).hide();
$("#post" + $(this).data("parent")).load("/reply?parentPost=" + $(this).data("parent") + "&originalPost=" + $(this).data("origional"), function () {
<?php
////////////////////////////////////
// This is my answer to the following
// http://skilleo.me/challenge/2
//
//
// Seems to crash it out =/
////////////////////////////////////
<?php
//
//
// http://skilleo.me/challenge/6
//
//
function textAnalytics($a) {
/* Create the code to gather the text analytics here. */
$return = "";
// Number of words ----- Need to take one away for some reason, your counter is wrong.
<?
This is extremely useful, I have a suggestion to get around the wp_site and wp_home situation though.... you can define that in your config.
define('WP_HOME', 'http://'.$_SERVER['SERVER_NAME']);
define('WP_SITEURL', 'http://'.$_SERVER['SERVER_NAME']);
?>
<?
define('WP_HOME', 'http://'.$_SERVER['SERVER_NAME']);
define('WP_SITEURL', 'http://'.$_SERVER['SERVER_NAME']);
?>
@p4ulypops
p4ulypops / After Form
Last active August 29, 2015 14:01
UNTESTED CODE - A simple unubtrusive captcha, that requires JS and Cookies to be enabled, as well make sure the form isn't submited before 3 seconds.
<?php
$expectedTimeField = md5($_SESSION['captcha_field']."_timer");
if (
empty($_POST[$expectedTimeField]) // Timer field doesn't exist, fake it.
|| !is_numeric($_POST[$expectedTimeField]) // Timer is non-numeric, JS didn't exec, fake it.
|| ($_SESSION['captcha_time'] + 3000) < (time() + date("Z", time()) ) // They took less than 3 seconds, fake it.
) {
$(".date_form").change(function() {
var year = $("#year").val();
var month = $("#month").val();
var day = $("#day").val();
var birth_date = new Date(year, month, day);
var birth_year = birth_date.getFullYear();
var birth_month = month;
var birth_day = day;
var baby_number = 0;
<?php
// IF you want it to include the days, follow the logic.
$time = "1:66";
$timeArray = explode($time, ":");
if (count($timeArray) == 3) { // there is something like "5:12:23";
$seconds = ($timeArray[0] * 60 * 60) + ($timeArray[1] * 60) + $timeArray[2];
} elseif(count($timeArray) == 2) { // there is something like "15:60";
$seconds = ($timeArray[0] * 60) + $timeArray[1];
<?php
class introduction extends CI_Controller
{
var $data = [];
private function __construct()
{
parent::__construct();