Skip to content

Instantly share code, notes, and snippets.

@withremote
withremote / txplib_db.php
Created Apr 28, 2016
Drop in replacement to support Textpattern DB library past PHP 5.5.9
View txplib_db.php
<?php
/**
* Class DB
*/
class DB
{
/**
* @var
*/
protected $config;
View provision-selenium.sh
#!/usr/bin/env bash
# ===================================================
# Start Setup
# ===================================================
cd ~/
# Update yum
sudo yum -y update
# ===================================================
@withremote
withremote / get_selenium.sh
Created Nov 19, 2015
Get Selenium and Firefox for headless testing in vagrant box
View get_selenium.sh
#!/usr/bin/env bash
# Get Selenium and Firefox for headless testing in vagrant box
if [ ! -d "/var/selenium" ]; then
sudo mkdir /var/selenium
cd /var/selenium
sudo wget http://goo.gl/PJUZfa selenium-server-standalone.jar
fi
sudo yum -y install java-1.8.0-openjdk-headless.x86_64
sudo yum -y install firefox.x86_64
sudo yum -y install xorg-x11-server-Xvfb.x86_64
@withremote
withremote / GetMail.php
Created Sep 24, 2015
Get mail from a pop/imap email box
View GetMail.php
<?php
/*
* File: GetMail.php
* Description: Receiving mail With Attachments
*
* @package Pbc\Mail
* @author Mitul Koradia <mitulkoradia@gmail.com>
* @author Nate Nolting <naten@paulbunyan.net>
* @version: 1.1
*/
@withremote
withremote / MY_Session.php
Created Jan 8, 2015
Session library override if running tests
View MY_Session.php
<?php
class MY_Session extends CI_Session {
protected $cliTestingDriver = 'codeception';
public function __construct(array $params = array())
{
parent::__construct($params);
@withremote
withremote / Session_codeception.php
Created Jan 8, 2015
CI3 flat file session driver used for testing with Codeception
View Session_codeception.php
<?php
/**
* CI3 flat file session driver used for testing with Codeception
*/
/**
* Class CI_Session_codeception
*/
class CI_Session_codeception extends CI_Session_driver
View txplib_misc.php
// -------------------------------------------------------------
// Format a time, respecting the locale and local time zone,
// and make sure the output string is safe for UTF-8
function safe_strftime($format, $time='', $gmt=0, $override_locale='')
{
global $locale;
$old_locale = $locale;
if (!$time)
$time = time();
@withremote
withremote / Premailer.php
Last active Aug 29, 2015
php connection to premailer api
View Premailer.php
<?php
/**
* Premailer API PHP class
* Premailer is a library/service for making HTML more palatable for various inept email clients, in particular GMail
* Primary function is to convert style tags into equivalent inline styles so styling can survive <head> tag removal
* Premailer is owned by Dialect Communications group
* @link http://premailer.dialect.ca/api
* @author Marcus Bointon <marcus@synchromedia.co.uk>
*/
@withremote
withremote / Cache.php
Created Mar 13, 2013
codeigniter-cache delete_all()
View Cache.php
/**
* Delete Full Cache or Cache subdir
* Skips .htaccess and index.htm(l) files for security
*
* @access public
* @param string
* @return void
*/
function delete_all($dirname = '')
{
@withremote
withremote / resize_iframe_js.misc.txp
Last active Dec 12, 2015
Iframe not auto expanding in IE8 or lower on XP
View resize_iframe_js.misc.txp
<iframe src="/somelocalfile.htm" frameborder="0" scrolling="no" width="100%" id="myIframe" class="auto-height"></iframe>
<script type="text/javascript" src="/js/libs/iframe-auto-height/jquery.iframe-auto-height.js"></script>
<script language="JavaScript">
jQuery('iframe.auto-height').iframeAutoHeight({
heightOffset: 10,
minHeight: 300
});
</script>
You can’t perform that action at this time.