Skip to content

Instantly share code, notes, and snippets.

View snipe's full-sized avatar
😁
Jazzed to be releasing Snipe-IT v7 soon!

snipe snipe

😁
Jazzed to be releasing Snipe-IT v7 soon!
View GitHub Profile
@snipe
snipe / gist:1469447
Created December 12, 2011 22:31 — forked from irohiroki/gist:909284
jQuery Mobile Red and Green themes for Buttons
/* 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 February 27, 2012 18:07
Add/remove fields dynamically in jQuery Mobile, disable buttons once max/min fields reached
<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 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)
@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 / 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 / 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 / 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 / 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 / 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 / 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'