Skip to content

Instantly share code, notes, and snippets.

View zsim0n's full-sized avatar

Zoltan Simon zsim0n

View GitHub Profile
@tpokorra
tpokorra / kolabrss.php
Last active December 18, 2015 02:38
this script is used for creating an RSS feed from Typo3 pages, without touching the Typo3 installation
<?php
function getContent(&$contents, $startContentStr, $endContentStr)
{
// if we want the content of an html element, we need to count, eg. the div's
$element = '';
if ($startContentStr[0] == '<' && substr($endContentStr, 0, 2) == '</')
{
$posSpace = strpos($startContentStr, ' ');
@stephenharris
stephenharris / color_luminance.php
Created May 7, 2013 14:19
Lighten or darken a given colour
<?php
/**
* Lightens/darkens a given colour (hex format), returning the altered colour in hex format.7
* @param str $hex Colour as hexadecimal (with or without hash);
* @percent float $percent Decimal ( 0.2 = lighten by 20%(), -0.4 = darken by 40%() )
* @return str Lightened/Darkend colour as hexadecimal (with hash);
*/
function color_luminance( $hex, $percent ) {
// validate hex string
<?php
namespace Acme\DemoBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ImportCSVCommand extends ContainerAwareCommand
@istepanov
istepanov / gist:3950977
Created October 25, 2012 07:00
Remove PHPStorm settings from Mac OS X 10.8 Mountain Lion
#!/usr/bin/sh
rm -rf "$HOME/Library/Preferences/WebIde40"
rm -rf "$HOME/Library/Caches/WebIde40"
rm -rf "$HOME/Library/Application Support/WebIde40"
rm -rf "$HOME/Library/Logs/WebIde40"
@havvg
havvg / ajax-form.js
Created August 1, 2012 13:20
jQuery AJAX form submit with Twitter Bootstrap modal
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@ecampidoglio
ecampidoglio / Out-Diff.ps1
Created January 18, 2012 21:48
A PowerShell function to colorize a sequence of text lines that represent an Universal Diff. For more information, see http://megakemp.com/2012/01/19/better-diffs-with-powershell/
function Out-Diff {
<#
.Synopsis
Redirects a Universal DIFF encoded text from the pipeline to the host using colors to highlight the differences.
.Description
Helper function to highlight the differences in a Universal DIFF text using color coding.
.Parameter InputObject
The text to display as Universal DIFF.
#>
[CmdletBinding()]
@yuya-takeyama
yuya-takeyama / 1.travis.yml
Created December 19, 2011 17:33
Travis CI PHP
language: php
php:
- 5.3
- 5.4
@uppfinnarjohnny
uppfinnarjohnny / ActiveCollab.php
Created December 5, 2011 16:01
Simple API wrapper for ActiveCollab
<?php
class ActiveCollab {
protected $base_url;
protected $api_key;
public function __construct($base_url, $api_key) {
$this->base_url = $base_url;
$this->api_key = $api_key;
}
@robo47
robo47 / behat-jenkins.txt
Created October 10, 2011 09:50
Behat, Symfony2, Jenkins
Ant-Task which runs behat:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Foo" default="build" basedir=".">
....
<target name="behat">
<exec dir="${basedir}/" executable="php" failonerror="true">
@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
{