Skip to content

Instantly share code, notes, and snippets.

View kix's full-sized avatar

Stepan Anchugov kix

View GitHub Profile
@beberlei
beberlei / Document.php
Created May 18, 2011 10:46
My Symfony2 File Upload workflow
<?php
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* @Entity
*/
class Document
{
@jonahlyn
jonahlyn / multicheckbox.php
Created April 22, 2011 21:22
Custom render a Zend Form MultiCheckbox element with a viewscript
$audience = new Zend_Form_Element_MultiCheckbox('audience', array(
'label' => 'Target Audience',
'required' => true,
'multiOptions' => array(
'students' => 'Students',
'faculty' => 'Faculty',
'staff' => 'Staff',
'stustaf' => 'Student Employees',
'retiree' => 'Emeritus/Retiree'),
'validators' => array(
@marcw
marcw / gist:909430
Created April 8, 2011 07:20
Add twig search to ack-grep
alias ack='ack-grep --type-set twig=.twig'
@SeanJA
SeanJA / build.xml
Created March 23, 2011 14:25
precommit-hook to run ant tasks and store the results and then add them to the commit
<?xml version="1.0" encoding="utf-8" ?>
<project name="Webads">
<!--This target runs the phpcs-->
<target name="phpcs">
<!--unix-->
<exec dir="${basedir}" executable="phpcs" failonerror="false" osfamily="unix">
<arg line="--standard=Cake --extensions=php,module,inc ${basedir}"/>
</exec>
</target>
@pullmonkey
pullmonkey / gist:783562
Created January 17, 2011 21:54
Comprehensive PHP VIN Decoder using VIN API
<?
// VIN API decoder for PHP 4.x+
define('ELEMENT_CONTENT_ONLY', true);
define('ELEMENT_PRESERVE_TAGS', false);
function getXML($vin) {
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, 'http://vinapi.skizmo.com/vins/'. $vin.'.xml');
curl_setopt ($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', 'X-VinApiKey: #YOURAPIKEYGOESHERE#')); //use your API key here
# How to echobot with XMPP, BOSH, and Strophe
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this
#/etc/hosts
127.0.0.1 localhost.local
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server.
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0)
@mbbx6spp
mbbx6spp / capistrano_git_tasks.rb
Created July 24, 2009 19:16
Git (submodule) Capistrano tasks
# 2009 Copyright Susan Potter <me at susanpotter dot net>
# You can read her software development rants at: http://geek.susanpotter.net
# Released under CreativeCommons-attribution-noncommercial-sharealike license:
# http://creativecommons.org/licenses/by-nc-sa/1.0/
namespace :git do
namespace :submodule do
desc "Initializes submodules"
task :init, :roles => :app do
invoke_command "cd #{current_path} && git submodule init", :via => run_method
end