Skip to content

Instantly share code, notes, and snippets.

View kix's full-sized avatar

Stepan Anchugov kix

View GitHub Profile
@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
# 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)
@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
@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>
@marcw
marcw / gist:909430
Created April 8, 2011 07:20
Add twig search to ack-grep
alias ack='ack-grep --type-set twig=.twig'
@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(
@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
{
@DavertMik
DavertMik / gist:1936860
Created February 29, 2012 01:40
Dependency Management Concept. RFC

This is about getting rid of Dependency Injection Container and DI practices taken from Java. Good bye Java, viva la PHP!

We start with common example. Session.

<?php

class SessionStorage {

 	function __construct() 
@dhavaln
dhavaln / camera.html
Created March 29, 2012 14:33
Phonegap Camera Capture Example
<!DOCTYPE html>
<html>
<head>
<title>Capture Photo</title>
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1"/>
<script type="text/javascript" charset="utf-8" src="js/phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
var pictureSource; // picture source
var destinationType; // sets the format of returned value
@airlst
airlst / Portfile
Created April 18, 2012 19:27
Install PHP-FPM on OSX with Macports
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 89615 2012-02-04 05:28:00Z ryandesign@macports.org $
PortSystem 1.0
name php5
conflicts php5-devel php52
# Keep version of php5 in sync with bundled php5 extension ports.
# Increment revision of php5-eaccelerator when updating version of php5.
epoch 1