Skip to content

Instantly share code, notes, and snippets.

View saltybeagle's full-sized avatar

Brett Bieber saltybeagle

View GitHub Profile
@saltybeagle
saltybeagle / gist:6023023
Created July 17, 2013 18:16
The Eagles — Moscow Airport Terminal (Edward Snowden Anthem)
On a dark server farm, the NSA lies in wait
Machines that have been listening, since 1998.
Up a head in the distance, I saw a shimmering light
My head grew heavy and my laptop grew dim
I had to get off of the flight
There he stood in the terminal.
With the passport scanning system
And I was thinking to myself
"This could be deportation or this could be asylum"
@saltybeagle
saltybeagle / events.sql
Created December 12, 2012 22:45
Improving recurring events SQL
SELECT eventdatetime.*
FROM eventdatetime
JOIN calendar_has_event ON calendar_has_event.event_id = eventdatetime.event_id AND calendar_has_event.calendar_id=1
LEFT JOIN recurringdate ON eventdatetime.event_id = recurringdate.event_id
WHERE
(calendar_has_event.status ='posted' OR calendar_has_event.status ='archived')
AND (eventdatetime.starttime LIKE '2009-11-28 %'
AND (eventdatetime.recurringtype = 'none' OR eventdatetime.recurringtype = '')
OR ( recurringdate.recurringdate = '2009-11-28' AND recurringdate.unlinked = FALSE)
)
@saltybeagle
saltybeagle / test.php
Created August 30, 2012 16:42 — forked from mfairchild365/test.php
Simple, configureable and lightweight Spam Detector
<?php
$spamChecker = new SpamChecker();
$spamChecker->addRule(function($spam){
if (strpos($spam, 'test') !== false) {
return true;
}
});
echo "The following should be true" . PHP_EOL;
var_dump($spamChecker->isSpam('this is a test'));
@saltybeagle
saltybeagle / gitmigrat.sh
Created May 2, 2012 15:26
svn2git all GForge repositories
migratdir=$PWD
for dir in `ls -1 */.svn/entries | xargs grep -H -l gforge | grep -E -o "^[^\/]+"`; do
echo $dir
mkdir /Users/bbieber/workspace/gitmigrat/$dir
cd /Users/bbieber/workspace/gitmigrat/$dir
svn2git `svn info $migratdir/$dir | grep ^Repository\ Root | cut -f 3 -d ' '` --authors $migratdir/gforgemigration/authors.txt --verbose
done
@saltybeagle
saltybeagle / gist:2159431
Created March 22, 2012 16:36
Set logout URL in the 3.x templates.
<script type="text/javascript">
//<![CDATA[
WDN.initializePlugin('idm', function(){
WDN.idm.setLogoutURL('/apps/logout.ashx');
});
//]]>
</script>
@saltybeagle
saltybeagle / list_packages.php
Created January 10, 2012 14:47
Example for communicating with a remote PEAR channel
<?php
// Remove this if using Pyrus from source
namespace PEAR2;
/**
* Example for communicating with a remote PEAR channel
*/
require_once 'phar:///Users/bbieber/Documents/workspace/Pyrus/pyrus.phar/PEAR2_Pyrus-2.0.0a3/php/PEAR2/Autoload.php';
$config = Pyrus\Config::singleton('/tmp');
@saltybeagle
saltybeagle / package.xml
Created October 11, 2011 13:39
Valid package.xml for pecl.php.net/zip-1.10.2
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.8.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>zip</name>
<channel>pecl.php.net</channel>
<summary>A zip management extension</summary>
<description>Zip is an extension to create, modify and read zip files.</description>
<lead>
<name>Pierre-Alain Joye</name>
<user>pajoye</user>
<email>pajoye@php.net</email>
@saltybeagle
saltybeagle / .htaccess
Created October 7, 2011 16:30
Cross-origin Web Fonts
AddType font/x-woff .woff
AddType image/svg+xml .svg
AddType application/vnd.ms-fontobject .eot
SetEnvIf Origin "^(.*\.unl\.edu)$" ORIGIN_SUB_DOMAIN=$1
<FilesMatch "\.(svg|eot|woff)$">
Header set Access-Control-Allow-Origin "%{ORIGIN_SUB_DOMAIN}e" env=ORIGIN_SUB_DOMAIN
</FilesMatch>
@saltybeagle
saltybeagle / gist:1260758
Created October 4, 2011 02:14
Self-contained PHPUnit with Pyrus
mkdir phpunit
cd phpunit
pyrus `pwd` set bin_dir `pwd`/bin
pyrus `pwd` install http://components.ez.no/get/ConsoleTools-1.6.1.tgz http://components.ez.no/get/Base-1.8.tgz pear.phpunit.de/PHPUnit
To set the include_path, replace the first line of bin/phpunit with:
#!/usr/bin/php -d include_path=/path/to/phpunit/php
@saltybeagle
saltybeagle / reproduce_pyrus_make.sh
Created August 7, 2011 15:01 — forked from Tyrael/reproduce_pyrus_make.sh
reproduce pyrus make
#!/bin/bash
mkdir 'reproduce_pyrus_make';
cd 'reproduce_pyrus_make';
git clone 'git://github.com/pyrus/Pyrus.git';
git clone 'git://github.com/pyrus/Pyrus_Developer.git';
git clone 'git://github.com/pear2/PEAR2_Autoload.git';
git clone 'git://github.com/Tyrael/suhosin.git';
cd 'Pyrus';
cd 'data';
ln -s ../../Pyrus_Developer/customcommand/commands.xml local-developer-commands.xml