Skip to content

Instantly share code, notes, and snippets.

View dario1985's full-sized avatar

Dario dario1985

  • Barcelona, Spain
View GitHub Profile
@dario1985
dario1985 / sphinx.conf
Created August 9, 2012 13:28
Sphinx configuration file using php
#!/usr/bin/php
#############################################################################
#
# S P H I N X C O N F I G U R A T I O N
#
#############################################################################
<?php
define('SPHINX_CONF_SOURCES_DIR', __DIR__ . DIRECTORY_SEPARATOR . "sources.d");
@dario1985
dario1985 / gist:1959705
Created March 2, 2012 17:10
CakePHP Mongodb - update nested attributes
function generateSetArguments($data) {
$fieldsAndValues = array();
$iterator = new RecursiveIteratorIterator(new RecursiveArrayOnlyIterator($data));
foreach ($iterator as $value) {
$path = array();
foreach (range(0, $iterator->getDepth()) as $depth) {
$path[] = $iterator->getSubIterator($depth)->key();
}
$path = implode('.', $path);
$fieldsAndValues[$path] = $value;
@dario1985
dario1985 / git-submodule
Created November 7, 2011 14:31
git-submodule
#!/bin/bash
CURRENT_DIR=$( pwd )
ARGS=$*
function move () {
from_path=$1
to_path=$2
#vim .gitmodules
#git add .gitmodules