Skip to content

Instantly share code, notes, and snippets.

View cgutierrez's full-sized avatar

Chris Gutierrez cgutierrez

View GitHub Profile
@cgutierrez
cgutierrez / FunctionBodyReflection.php
Created October 20, 2010 17:46
Extension to ReflectionFunction for getting a functions body and character count.
<?php
class FunctionBodyReflection extends ReflectionFunction
{
/**
* get the body of a function as a string
*
* @access public
* @param bollean $withDeclaration true to return entire function delcaration
* @return String
*/
@cgutierrez
cgutierrez / Base File.json
Last active September 27, 2015 12:58
Sublime Text 2 Config Files
{
"bold_folder_labels": true,
"color_scheme": "Packages/Theme - Refined/Color Schemes/Monokai Refined.tmTheme",
"file_exclude_patterns":[
".DS_Store",
"dump.rdb",
".git*"
],
"folder_exclude_patterns":[
".git",
@cgutierrez
cgutierrez / .vimrc
Created October 16, 2011 14:28
Vim Configuration
:set expandtab
:set tabstop=4
:retab
:set shiftwidth=4
:syntax on
@cgutierrez
cgutierrez / php.ini
Created October 26, 2011 16:56
General php configuration values
post_max_size=100M
open_basedir = /var/www/vhosts
upload_max_filesize = 100M
date.timezone = America/New_York
@cgutierrez
cgutierrez / example.html
Created November 10, 2011 03:00
jquery.tagly example
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<link href="style.css" rel="stylesheet">
</head>
<body>
<div id="tags"></div>
@cgutierrez
cgutierrez / qrcodes.py
Created January 8, 2012 20:27
Save Hi-Res QR codes
from zope.testbrowser.browser import Browser
from time import sleep
storyIds = range(1, 201)
rootUrl = "http://example.com/%s"
for storyId in storyIds:
url = rootUrl % (storyId)
browser = Browser("http://qrickit.com/qrickit_apps/qrickit_qrcode_creator_url.php")
@cgutierrez
cgutierrez / Less Compile.sublime-build
Created February 10, 2012 15:28 — forked from druu/Less Compile.sublime-build
LessCSS Build System for Sublime Text 2
/**
* Basic LessCSS Build System for Sublime Text 2
*
* Prerequisites: node.js, global lesscss node module
* How it works:
* 1. Create the folders "src/css" and "assets/css" in your project root
* 2. Put all your .less files into "src/css"
* 3. Open your main .less file and hit "Build"
* 4. Dance happily around your minified and compiled CSS file in "assets/css"
* 5. Profit
@cgutierrez
cgutierrez / calculate_filter.php
Created May 11, 2012 03:01
Blackbe.lt - Lithium Method Filters
<?php
PriceCalculator::applyFilter('calculate', function($self, $args, $chain) {
// code here will get executed before the calculation has occurred
extract($args); //$qty, $item
$total = $chain->next($self, $args, $chain);
if (date('n') === "6") {
@cgutierrez
cgutierrez / aop.php
Created August 25, 2012 18:39
Lithium Presentation Examples
<?php
class Email {
protected $logger;
public function __construct(Logger $logger = null) {
$this->setLogger($logger);
}
@cgutierrez
cgutierrez / action.php
Created October 10, 2012 02:42
Lithium Global CSRF Protection
use lithium\action\Dispatcher;
use lithium\storage\Session;
use lithium\security\validation\RequestToken;
use lithium\action\Response;
Dispatcher::applyFilter('run', function($self, $params, $chain) {
$request = $params['request'];
$excludes = array('get', 'head', 'options');