Skip to content

Instantly share code, notes, and snippets.

@hellozach
hellozach / polyfill-input-time.js
Created October 5, 2015 23:57
Adds a polyfill for browsers that do not support time inputs.
$.fn.timepicker = function() {
return this.each(function() {
var self = $(this),
rqrd = self.prop('required'),
poly = $('<div class="form-inline polyfill-time" />'),
hour = $('<input type="number" class="form-control" size="2" maxlength="2" placeholder="12">'),
mins = $('<input type="number" class="form-control" size="2" maxlength="2" placeholder="00">'),
ampm = $('<select class="form-control"><option value="am">AM</option><option value="pm">PM</option></select>'),
time = {
hour: 0,
<?php
require_once "includes/config.php";
$enqueue->add('script','js-for-about'); // loads JS for about.php only
$enqueue->add('style','about-only-styles'); // loads CSS for about.php only
include "theme/header.php";
?>
<h2>About</h2>
<!doctype html>
<html>
<head>
<?php
$enqueue->load('styles');
?>
</head>
<body>
<h1>Header</h1>
<?php
/**
* includes/config.php
*/
require_once "Enqueue_class.php";
$enqueue = new Enqueue();
// ... the rest of your config file.
<?php
/**
* about.php
*/
require_once "includes/config.php";
include "theme/header.php";
?>
@hellozach
hellozach / Enqueue_class.php
Last active August 29, 2015 14:15
PHP Enqueue Class
<?php
/**
* Enqueue JavaScript and CSS Styles.
*
* @version 1.0 2015/02/18
* @author Zach Johnson <[email protected]>
*/
class Enqueue {
/** Start Config area */
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Enqueue JavaScript and CSS Styles in CodeIgniter with a simple, lightweight library.
* CodeIgniter_Root/application/libraries/enqueue.php
* Version: 1.0
*/
class Enqueue {
public $scripts;