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
[
{ "keys": ["ctrl+shift+a"], "command": "select_all" },
{ "keys": ["ctrl+a"], "command": "expand_selection", "args": {"to": "scope"} },
{ "keys": ["alt+shift+f"], "command": "reindent", "args": {"single_line": false} }
]
@dogmatic69
dogmatic69 / private.php
Last active October 22, 2015 08:24
calling private methods in a class through a proxy class using closure binding.
<?php
/**
* Class with private methods that you need to access
*/
class Something {
private function _wtf() {
return 'yey';
}
@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
@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 / 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:

<?php
$users = json_decode(file_get_contents('https://api.github.com/repos/:user/:repo/stargazers'), true);
foreach ($users as $user) {
$user = json_decode(file_get_contents($user['url']), true);
if (!empty($user['email']) {
mail($user['email'], 'Can has mail', $message);
}
}
<?php
class Php53Traits {
public function __call($name, $params) {
if(!isset($this->{$name}) || !gettype($this->{$name}) == 'object') {
throw new Exception('not found');
}
$tmp = $this->{$name};
return call_user_func_array($tmp, $params);
}
#!/bin/bash
DAY=$(date +"%a")
NOW=$(date +"%Y-%m-%d")
DATETIME=$(date +"%Y-%m-%d-%H:%M")
BACKUPHOME=/home/backups
BACKUPWORKING=$BACKUPHOME/.working
BACKUP=$BACKUPWORKING/.$$
EMAIL="some@email.com"
@dogmatic69
dogmatic69 / post-receive.sh
Created November 11, 2012 02:17
Git deploy hook for Infinitas
#!/bin/sh
cd ..
env -i git reset --hard
env -i git submodule update --recursive
env -i Console/cake data.clear_cache
@dogmatic69
dogmatic69 / nef2png.sh
Created August 28, 2012 14:56
convert nikon NEF files to png
#!/bin/bash
##################################
# Convert files to png #
# #
# #
##################################
files=`ls ./`;
if [ ! -d png ]
then