Skip to content

Instantly share code, notes, and snippets.

@josegonzalez
josegonzalez / nginx-custom.rb
Created November 21, 2012 17:53
Customize your Nginx Installation via Homebrew
require 'formula'
class NginxCustom < Formula
homepage 'http://nginx.org/'
url 'http://nginx.org/download/nginx-1.2.4.tar.gz'
sha1 'e3de0b2b82095f26e96bdb461ba36472d3e7cdda'
devel do
url 'http://nginx.org/download/nginx-1.3.8.tar.gz'
sha1 '84ff39e3f76e9f496f4e05080885e04caf472bb9'
@josegonzalez
josegonzalez / gist:2855592
Created June 1, 2012 22:50
Server monitoring

Now that SeatGeek is crushin it, it has become apparent that we need some sort of server/service monitoring beyond simple healthchecks with pingdom.

This should be split up into multiple parts, but the idea is thus:

Metric Collection

Collect metrics from various servers, including, but not limited to:

  • disk space
  • load average
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>{Title}</title>
<link rel="shortcut icon" href="{Favicon}">
<link rel="alternate" type="application/rss+xml" href="/rss">
<style type="text/css">
body {
@josegonzalez
josegonzalez / .bashrc
Created March 28, 2012 03:23
My ~/.bashrc
export PATH="$(brew --prefix)/bin:$(brew --prefix php)/bin:$(brew --prefix python)/bin:/usr/local/share/python:/usr/local/lib/node_modules:/usr/local/PEAR:$PATH"
export NODE_PATH=/usr/local/lib/node_modules
export GIT_EDITOR="subl -w" # Change to whatever you want your default git editor to be
export RUBYOPT=rubygems
# a crap-ton of ssh aliases
alias update='brew update && brew outdated | xargs brew upgrade'
alias ls='ls -alh'
alias ll='ls -alh'
@josegonzalez
josegonzalez / app_controller.php
Created February 27, 2012 05:25
Custom response types in CakePHP. Must have debug mode to less than 2 in order for it to work properly
<?php
class AppController extends Controller {
/**
* Setup the RequestHandler component
*
* @var array
*/
var $components = array('RequestHandler');
@josegonzalez
josegonzalez / subdomain.php
Created December 19, 2011 21:00
subdomain component for cakephp that depends on a model
<?php
class SubdomainComponent extends Object {
var $__settings = array(
'base' => 'example.com',
'domains' => array(),
'param' => 'subdomain',
'redirect' => true,
'redirectTo' => 'http://example.com',
'model' => 'DomainPrefix',
@josegonzalez
josegonzalez / control
Created April 10, 2011 22:53
cakepackages control file
Package: cakepackages
Source: git://github.com/josegonzalez/cakepackages.git
Type: application
Section: application
Description: An application that can be used
to index other cakephp applications and plugins
Pre-depends: CakePHP==1.3
Recommends:
Suggests:
Bugs: http://github.com/josegonzalez/cakepackages/issues
@josegonzalez
josegonzalez / readme.md
Last active November 17, 2018 16:16
Example Readme for CakePHP plugins that use MIT license

[PLUGIN NAME] Plugin

[ONE LINE DESCRIPTION OF PROJECT]

Background

[A PARAGRAPH DESCRIBING WHY YOU BUILT THIS]

[ANOTHER PARAGRAPH DESCRIBING YOUR IMPETUS FOR RELEASING THIS]

@josegonzalez
josegonzalez / gist:888471
Created March 26, 2011 17:43
thoughts on cakepackages

Anyhow, I wrote a blog post on the subject quite a while ago, which is pretty much a braindump of what I am attempting with CakePackages. I also wrote a post on what I thought The Chaw might have been had development on CakePHP not split.

I'm currently working on a smarter package classifier, one that uses the Reflection api, but unfortunately there are MANY bugs with my current approach. My current output (as of yesterday) is the following thus. I'd like to complete this before I continue working on CakePackages in the general sense.

Other things I'd like to do are default to showing an up to date readme, allow commenting/tagging/usage counters for given packages, supporting github organizations, as well as displaying forks on the site. I also have a non-working plugin installer (not the one on github) that I'm futzing with local

@josegonzalez
josegonzalez / unholy.php
Created March 17, 2011 19:01
PHP Variables, method names, and class names are ridiculous
<?php
$classMap = array(
'AggregateRecordSales' => 'band_id',
'BandInfoDaily' => 'team_id',
'DivisionStandings' => 'team_id',
'TeambandPriceCache' => 'teamband_id',
);
$baseClassVar = 'baseClass';
$inflection = 'inflect';
foreach ($classMap as $baseClass => $fieldName) {