Skip to content

Instantly share code, notes, and snippets.

Avatar
😁
I may be slow to respond.

snipe snipe

😁
I may be slow to respond.
View GitHub Profile
@snipe
snipe / gist:1469447
Created Dec 12, 2011 — forked from irohiroki/gist:909284
jQuery Mobile Red and Green themes for Buttons
View gist:1469447
/* F
-----------------------------------------------------------------------------------------------------------*/
.ui-btn-up-f, .ui-btn-hover-f, .ui-btn-down-f {
color: white;
font-weight: bold;
text-decoration: none; }
.ui-btn-up-f {
border: 1px solid #711414;
background: #ab2525;
@snipe
snipe / gist:1925906
Created Feb 27, 2012
Add/remove fields dynamically in jQuery Mobile, disable buttons once max/min fields reached
View gist:1925906
<script>
/*
See the full details here:
http://www.snipe.net/2012/02/jquery-mobile-add-remove-fields-dynamically/
Based on the great post by Charlie Griefer, available here:
http://charlie.griefer.com/blog/2009/09/17/jquery-dynamically-adding-form-elements/
*/
@snipe
snipe / headers-in-bed
Created Nov 1, 2012
HTTP Error codes as fortune cookies
View headers-in-bed
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)
@snipe
snipe / htaccess-ip-lock
Created Nov 6, 2012
Htaccess to handle IP whitelisting, password prompt otherwise
View htaccess-ip-lock
# 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 / build-ant-phpunit
Created Nov 22, 2012
Apache Ant build.xml file for PHPUnit+Jenkins+Ant+Zend Framework
View build-ant-phpunit
<?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 / gist:4256150
Created Dec 11, 2012
Apache Ant build.xml file for PHPUnit+Jenkins+Ant+Symfony2
View gist:4256150
<?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 / profanity
Last active Jan 4, 2018
PHP Profanity Filter Sample Script
View profanity
This script is now available at banbuilder.com or https://github.com/snipe/banbuilder
@snipe
snipe / rss_img_ripper.php
Last active May 16, 2017
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.
View rss_img_ripper.php
<?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 / linux-ci
Created Feb 16, 2013
Initial setup for Linux server to prepare for CI using Jenkins and PHP unit tests
View linux-ci
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 / date-php-ini
Created Feb 16, 2013
Set the date in php.ini
View date-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'