Skip to content

Instantly share code, notes, and snippets.

View dogmatic69's full-sized avatar
🎯
Building the new IKEA

Carl Sutton dogmatic69

🎯
Building the new IKEA
View GitHub Profile
@dogmatic69
dogmatic69 / README.md
Last active August 29, 2015 14:00
DynaDNS type script for Rackspace based DNS

Poormans DynaDNS with rackspace

Uses online site to check current ip address which is saved to a file, when re-run the saved ip is compared with a check of the current again and if it is different will log into the rackspace API to remove the old entry and create a new one.

Best to have the DNS entry with a very short TTL, rackspace has 300 seconds as the shortest.

The mail file can be replaced with anything, or just blank for no action. By default it will mail if there has been a change or a problem processing the new ip address.

Add a cron:

@dogmatic69
dogmatic69 / AppController.php
Created May 9, 2014 00:39
bootstrap pagination in cake
class AppController extends Controller {
public $helpers = array(
'Paginator' => array(
'className' => 'Assets.BootstrapPaginator',
),
);
}
@dogmatic69
dogmatic69 / RubbishSocket.php
Created August 2, 2014 00:37
A Cake socket class for scraping a site to get UK rubbish collections days
<?php
App::uses('HttpSocket', 'Network/Http');
App::uses('CakeTime', 'Utility');
class RubbishSocket extends HttpSocket {
/**
* Page to scrape for collection days
*
* @var string
<?php
// Created by Guido Rossi <guidorossi@gmail.com>
// Date: 28/03/2008
// License: GNU General Public License v3
// Version: 1.1
class YahooFinance{
var $simbol;
@dogmatic69
dogmatic69 / csv.ctp.php
Created November 20, 2009 13:14
a layout for csv
<?php
// the layout
header( 'Content-type: application/octet-stream' );
header( 'Content-Disposition: attachment; filename="my-data.csv"');
echo $content_for_layout;
?>
<?php
// the view to create csv's
$a = array_keys( ClassRegistry::init( Inflector::singularize( $this->name ) )->_schema );
$needed = array(
Inflector::singularize( $this->name ) => $a
);
$row = array();
if ( !empty( $data ) )
@dogmatic69
dogmatic69 / google_charts_usage.php
Created November 25, 2009 14:57
how to use the chart helper
<h2>A test to make sure google is working</h2><?php
echo $this->Chart->test();
?><h2>Same as above but through the helper</h2><?php
echo $this->Chart->display(
'pie3d',
array(
'data' => '60,40',
'labels' => 'Hello,World',
'size' => '250,100',
<?php
/**
* Inflect Shell
*
* Inflect the heck out of your word(s)
*
* @category Shell
* @package Subway
* @version 0.1
* @author Jose Diaz-Gonzalez
@dogmatic69
dogmatic69 / range.php
Created December 10, 2009 12:49
needed for chart helper to generate ranges for x & y axyis
<?php
foreach(range('a', 'z') as $letter) {
echo $letter;
}
?>
This function will also work with numbers. This will print all the numbers from 1 to 12.
<?php
foreach(range(0, 12) as $number) {
<?php
class ContactComponent extends Object {
/**
* components being used here
*/
var $components = array();
var $errors = null;
var $setup = array(