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 / git-svn-post-import.php
Last active September 28, 2015 10:09
After running git svn clone, handy little script that will create all the correct branches and tags for the repo
#!/usr/bin/php5
<?php
$branches = array_filter(explode("\n", `git branch -r`));
`clear`;
foreach((array)$branches as $branch) {
echo sprintf("Working on %s\n======================================\n\n", $branch);
$commands = array();
$branch = trim($branch);
if(empty($branch)) {
@dogmatic69
dogmatic69 / standards-errors.txt
Created June 9, 2011 22:11
errors with coding standards
FILE: ...var/www/sites/dogmatic69.dev/public_html/core/assets/vendors/js_min.php
--------------------------------------------------------------------------------
FOUND 333 ERROR(S) AFFECTING 195 LINE(S)
--------------------------------------------------------------------------------
48 | ERROR | Line indented incorrectly; expected 0 spaces, found 0
48 | ERROR | Line indented incorrectly; expected 0 spaces, found 0
49 | ERROR | Space indented: Tabs for indents, spaces for alignment
50 | ERROR | Space indented: Tabs for indents, spaces for alignment
52 | ERROR | Space indented: Tabs for indents, spaces for alignment
52 | ERROR | Protected member variable "a" must contain a leading underscore
@dogmatic69
dogmatic69 / 1_backup.sh
Created April 22, 2011 00:03
moving aws locations
// log into the old server
ssh -i <key_file> ubunut@<old_ip>
// login as root
sudo su
// tar the entire drive skipping a few dirs
tar -cvpzf backup.tar.gz --exclude=~/backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev /
@dogmatic69
dogmatic69 / backup.sh
Created April 21, 2011 23:31
backing up an entire ubuntu / linux box
sudo su
tar -cvpzf backup.tar.gz --exclude=~/backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev /
Our root,
who art in Unix,
hallowed be thy shell.
Thy kernel come.
Thy commands be run
@localhost as they are in iNet.
Give us this day our daily updates,
And forgive us for our four-oh-threes,
as we forgive those who 403 against us.
And lead us not into segfaults,
@dogmatic69
dogmatic69 / colors.sh
Created March 22, 2011 10:20
output the colors and codes for use in terminals
#!/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
# http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
@dogmatic69
dogmatic69 / xhprof.php
Created March 8, 2011 02:47
profiling code
<?php
if(!defined('XHPROF_FLAGS_MEMORY')){
define('XHPROF_FLAGS_MEMORY', false);
}
if(!defined('XHPROF_FLAGS_NO_BUILTINS')){
define('XHPROF_FLAGS_NO_BUILTINS', false);
}
if(!defined('XHPROF_FLAGS_CPU')){
define('XHPROF_FLAGS_CPU', false);
}
@dogmatic69
dogmatic69 / lockable.php
Created March 8, 2011 02:42
locking database rows
<?php
/**
* lockable behavior.
*
* This behavior auto binds to any model and will lock a row when it is being
* edited by a user. only that user will be able to edit it while it is locked.
* This will avoid any issues with many people working on content at the same
* time
*
* Copyright (c) 2010 Carl Sutton ( dogmatic69 )
@dogmatic69
dogmatic69 / twitter.php
Created March 8, 2011 02:24
setting up the basics
<?php
class Connect extends TwitterAppModel{
/**
*
* @var string
*/
public $name = 'Connect';
public $schema = array(
'title' => array(
@dogmatic69
dogmatic69 / gumtree.php
Created March 8, 2011 02:19
reading feeds with a datasource in cakephp
<?php
class Gumtree extends JobAppModel{
public $name = 'Gumtree';
public $useDbConfig = 'Libs.XmlSource';
public $actsAs = false;
public $useTable = false;