Skip to content

Instantly share code, notes, and snippets.

View jakemcgraw's full-sized avatar
📈
start up cash in sell out bro down

Jake McGraw jakemcgraw

📈
start up cash in sell out bro down
View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title></title>
<script>
function foo(){
alert(this.tagName || this.nodeName);
};
<?php
/**
* Zend_Application, Zend_Loader, Zend_Loader_* and Zend_Exception require
* a 'hard coded' path. We've set up a special copy of the Zend Framework at:
*
* /usr/share/php/ZendFrameworkLoader/library
*
* This prevents the autoloader from confusingly loading the incorrect version
* of a given file.
@jakemcgraw
jakemcgraw / process_stdio.js
Created March 16, 2010 15:07
Read a stream in nodejs
// use tail -f /file/to/watch | node process_stdio.js to consume a stream
var partial = "", queue = [];
stdio = process.stdio;
stdio.open();
// Grab whole lines off of stdio
stdio.addListener("data", function(chunk) {
if (chunk) {
if ("" != partial) {
@jakemcgraw
jakemcgraw / modular.js
Created March 10, 2010 20:17
Organize jQuery code
var tspot = jQuery.extend(true, window.tspot || {}, {
log : function(message) {
(window.console && window.console.log) ?
window.console.log(message) :
alert(message);
},
// page specific functions under their own ns
});
jQuery(function($){
@jakemcgraw
jakemcgraw / ZendFramework_Auth.php
Created March 9, 2010 02:47
One way to do authorization in Zend Framework
<?php
// .. bootstrap
Zend_Registry::set('identity', new Zend_Session_Namespace());
// .. login
$result = $this->_auth->authenticate($adapter);
if ($result->isValid()) {
$ident = $this->_auth->getIdentity();
$model = new Model_User;
@jakemcgraw
jakemcgraw / check_php.pl
Created March 5, 2010 20:58
Nagios check for PHP configuration
#!/usr/bin/perl
use strict;
# default php executable, version
my $PHPBIN= '/usr/bin/php';
my $PHPVER= '5.2.10';
my $PEARBIN= '/usr/bin/pear';
my $MESSAGE= 'OK ';
use lib "/usr/lib/nagios/plugins";
@jakemcgraw
jakemcgraw / pear.rb
Created February 16, 2010 18:40
Puppet PHP Pear provider
We couldn’t find that file to show.