Skip to content

Instantly share code, notes, and snippets.

General Rules

  • were not here to do your homework.
  • this is an international group - keep it English please.
  • no AutoPosters
  • if posting a link, please be prepared to discuss your content
  • For God's sake, no "MySQL_*" advice.
  • Please don't post without discussing what you've posted about.

Permaban Offences;

  • Job Offers / Listings / Agencies.
@p4ulypops
p4ulypops / HTML Example
Created March 24, 2016 10:54
Just some waffle HTML.
<h1>This the largest Header (H1) </h1>
<h2>This one is next (H2)</h2>
<h3>And then (H3)</h3>
<blockquote> <p>Years ago my mother used to say to me, she'd say, "<em>In this world, Elwood, you must be</em>" - she always called me Elwood - "<em>In this world, Elwood, you must be oh so smart or oh so pleasant.</em>" Well, for years I was smart. I recommend pleasant. You may quote me.</p>
<h2>By Elwood P Dowd, <em>Harvey, the film</em></h2>
</blockquote>
<ul>
@p4ulypops
p4ulypops / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
On every WP site I do, where i'm the only developer, I add this to the config
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
<?
define('WP_HOME', 'http://'.$_SERVER['SERVER_NAME']);
define('WP_SITEURL', 'http://'.$_SERVER['SERVER_NAME']);
?>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
But my Localhost/dev-enviroment I setup my own domain, such as http://website.pp (.pp = .paulypops; it's just something that doesn't exist outside of my network).
But sometimes I also do the following if I've got a few collegues
<?php
class introduction extends CI_Controller
{
var $data = [];
private function __construct()
{
parent::__construct();
<?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];
$(".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;
@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.
) {
<?
define('WP_HOME', 'http://'.$_SERVER['SERVER_NAME']);
define('WP_SITEURL', 'http://'.$_SERVER['SERVER_NAME']);
?>
<?
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']);
?>