Skip to content

Instantly share code, notes, and snippets.

@boxers999
boxers999 / Ecoflow.html
Last active April 5, 2024 19:54
Basic Ecoflow data charting script. You need to request an API key from Ecoflow Support. Once you have this, replace these 3 sections (YOUR_SERIAL_NUMBER_HERE, API_KEY_GOES_HERE, SECRET_KEY_GOES_HERE) in the script . Then run in any web browser.
<!DOCTYPE html>
<html>
<head>
<title>Charts from JSON Response</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
canvas {
width: 300px;
height: 300px;
@boxers999
boxers999 / gist:1216045
Created September 14, 2011 07:38
PHP SplObserver Example
<?php
class DemoSubject implements SplSubject{
private $observer, $value;
public function __construct(){
$this->observers = array();
}
@boxers999
boxers999 / build.xml
Created May 31, 2011 21:09
build.xml file for Hudson - Php
<project name="Test Job" default="build">
<target name="clean">
<delete dir="${basedir}/svn/_build"/>
<delete dir="${basedir}/build"/>
</target>
<target name="prepare">
<mkdir dir="${basedir}/svn/_build/logs"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/docs"/>
</target>
@boxers999
boxers999 / gist:894191
Created March 30, 2011 10:43
PDO & MSSQL
<?php
/*
Downoad the new sqlsrv20 drivers from :- http://www.microsoft.com/downloads/en/details.aspx?FamilyID=80e44913-24b4-4113-8807-caae6cf2ca05
Copy to your php extensions directort and add to php.ini (Make sure you pick Thread Safe or None Thread Safe and the correct C compiler version. See top of phpinfo for compiler version).
I had ro rename :-
php_sqlsrv_53_nts_vc9.dll to php_sqlsrv.dll
@boxers999
boxers999 / Zend Framework Bootstrap.php
Created March 5, 2011 17:30
A fairly simple get you going bootstrap
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initAutoload()
{
$autoloader = new Zend_Loader_Autoloader_Resource(array(
'namespace' => '',
'basePath' => APPLICATION_PATH,
'resourceTypes' => array(
@boxers999
boxers999 / Zend Form Captcha.php
Created March 5, 2011 17:25
Structure for a Zend_Form_Element_Capcha() as an image
<?php
$captcha = new Zend_Form_Element_Captcha('captcha', // This is the name of the input field
array('label' => 'Are you human ?',
'captcha' => array( // Here comes the magic...
// First the type...
'captcha' => 'Image',
// Length of the word...
'wordLen' => 6,
// Captcha timeout, 5 mins