Skip to content

Instantly share code, notes, and snippets.

@npardington
npardington / bad_example.php
Last active December 24, 2015 21:38
Bad example of how things were done. Used in a blog post about using a framework.
<?php
error_reporting (E_ALL ^ E_NOTICE);
session_start();
include "./includes/class.pageClass.php";
require "./includes/class.requiredField.php";
require "./includes/inc.functions.php";
require "./includes/inc.dbConnection.php";
$page = new Page;
$page->Debug();
@npardington
npardington / page_class.php
Last active December 24, 2015 21:39
Bad example of a framework. Used in a blog post about frameworks.
<?php
class Page
{
//add a private called leader that is an instance of the leader class
public $title;
public $content;
public $script;
public $debug = false; //used for development used in Debug()
private $loggedIn = false;
public $contentHeading;
@npardington
npardington / render.php
Last active December 24, 2015 21:39
Bad render example. Used in a blog post about frameworks.
<?php
//we want to know what folder the script resides in (because I don't want to see index.php when I go to the home folder
$relativeLinks = "http://". $_SERVER['HTTP_HOST'] . "/" .substr(dirname($_SERVER['PHP_SELF']), strpos(dirname($_SERVER['PHP_SELF']), "/")+1) ;
//figure out admin links
$links = "";
$dumbLinks = "";
if ($_COOKIE['loggedin'] == "yes") //make sure admins have priority
{
@npardington
npardington / basic.php
Last active December 24, 2015 21:39
Basic bad example. Used in a blog post about frameworks
<?php
error_reporting (E_ALL ^ E_NOTICE);
session_start();
require "./includes/class.pageClass.php";
require "./includes/class.mailForm.php";
require "./includes/inc.dbConnection.php";
$page = new Page;
$page->Debug();
@npardington
npardington / models.py
Created October 8, 2013 03:26
Taken from djangotables2 example. Used in a blog post about frameworks.
# tutorial/models.py
class Person(models.Model):
name = models.CharField(verbose_name="full name")
@npardington
npardington / sermon_audion.py
Created February 7, 2014 03:18
Sermon Audio API Python Wrapper
import SermonAudioAPI
api = SermonAudioAPI('username', 'password')
# There are only a few categories you can search for:
# speaker
# eventtype
# series
# year
pip install sermon-audio