Skip to content

Instantly share code, notes, and snippets.

View snipe's full-sized avatar
🎯
Focusing

snipe snipe

🎯
Focusing
View GitHub Profile
@snipe
snipe / gist:4965564
Created February 16, 2013 04:39
Grab php jenkins template
curl https://raw.github.com/sebastianbergmann/php-jenkins-template/master/config.xml | java -jar jenkins-
cli.jar -s http://localhost:8080/cli create-job php-template
@snipe
snipe / add-gh
Created February 16, 2013 04:37
If your source code is hosted on GitHub, you'll want to add GH to your known hosts on your CI server to prevent issues during automated code checkout later as well.
ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts
@snipe
snipe / date-php-ini
Created February 16, 2013 04:36
Set the date in php.ini
vi /etc/php.ini
# add to php.ini:
zend_extension="/usr/lib64/php/modules/xdebug.so"
# Update timezone
date.timezone = 'AMERICA/New_York'
@snipe
snipe / linux-ci
Created February 16, 2013 04:34
Initial setup for Linux server to prepare for CI using Jenkins and PHP unit tests
yum install openssl-devel git php ant php-xml php-devel gcc make gcc-c++ freetype-devel fontconfig-devel
# Install node.js
cd /usr/local/src
wget http://nodejs.org/dist/v0.8.15/node-v0.8.15.tar.gz
tar zxvf node-v0.8.15.tar.gz
cd node-v0.8.15
# Install npm and n for easier updating
@snipe
snipe / rss_img_ripper.php
Last active July 28, 2023 14:00
Quick and dirty script to download thumbnail and fullsize images from RSS feed. The RSS feed can be remote, but this was a one-off I needed to throw together, so I just downloaded the RSS feed to my local drive.
<?php
$feed = 'recent.rss';
$xml = new SimpleXMLElement(file_get_contents($feed));
$xml->registerXPathNamespace('media', $feed);
$images = $xml->xpath('/rss/channel/item/media:content/@url');
foreach ( $xml->channel->item as $item ) {
$namespaces = $item->getNameSpaces(true);
$media = $item->children($namespaces['media']);
@snipe
snipe / profanity
Last active January 4, 2018 04:49
PHP Profanity Filter Sample Script
This script is now available at banbuilder.com or https://github.com/snipe/banbuilder
@snipe
snipe / gist:4256150
Created December 11, 2012 05:38
Apache Ant build.xml file for PHPUnit+Jenkins+Ant+Symfony2
<?xml version="1.0" encoding="UTF-8"?>
<!-- Set some basic project information and targets -->
<project name="My Symfony2 Project" default="build">
<target name="build"
depends="prepare, vendors, dbupdate, fixtures, lint, phploc, phpmd, phpcpd, phpcs, phpunit"/>
<target name="build-parallel"
depends="prepare, vendors, dbupdate, fixtures, lint, tools-parallel, phpcpd, phpunit"/>
@snipe
snipe / build-ant-phpunit
Created November 22, 2012 21:08
Apache Ant build.xml file for PHPUnit+Jenkins+Ant+Zend Framework
<?xml version="1.0" encoding="UTF-8"?>
<!-- Set some basic project information and targets -->
<project name="My ZF Project" default="build">
<target name="build"
depends="prepare, lint, phploc, phpmd, phpcpd, phpcs, phpunit"/>
<target name="build-parallel"
depends="prepare,lint, tools-parallel, phpcpd, phpunit"/>
@snipe
snipe / htaccess-ip-lock
Created November 6, 2012 03:51
Htaccess to handle IP whitelisting, password prompt otherwise
# Welcome to your htaccess file.
# Remember that modifying this file can break the entire website
# so please edit carefully.
# Also remember that the order of the rules below does matter,
# so be sure of what you're doing before shuffling things around.
AuthType Basic
AuthName "My Dev Environment"
# Specify what user/password file the server should look
@snipe
snipe / headers-in-bed
Created November 1, 2012 03:23
HTTP Error codes as fortune cookies
100 Continue (in bed)
101 Switching Protocols (in bed)
102 Processing (in bed)
200 OK (in bed)
201 Created (in bed)
202 Accepted (in bed)
203 Non-Authoritative Information (in bed)
204 No Content (in bed)
205 Reset Content (in bed)
206 Partial Content (in bed)