Skip to content

Instantly share code, notes, and snippets.

View jeromegamez's full-sized avatar
:octocat:

Jérôme Gamez jeromegamez

:octocat:
View GitHub Profile
@lolautruche
lolautruche / AdminController.php
Created June 2, 2013 19:58
eZ Publish 5 - Legacy module with a Symfony controller
<?php
/**
* AcmeTestBundle/Controller/AdminController.php
*/
namespace Acme\TestBundle\Controller;
use eZ\Bundle\EzPublishCoreBundle\Controller;
/**
* Here is your Symfony controller, defined as a service (see service definition below)
server {
listen 80;
server_name my-server.com;
access_log /var/log/nginx/my-server.com-access.log;
error_log /var/log/nginx/my-server.com-error.log;
root /var/www/my-server.com/public;
index index.php index.html;
anonymous
anonymous / duplicate_mf_meta
Created October 24, 2012 21:14
Magic Fields 2 - Post Duplications
//Duplicates Magic Field 2 meta data when using WPML to duplicate a post for translation
function duplicate_mf_meta($master_post_id, $target_post_id){
global $wpdb;
$table = $wpdb->prefix.'mf_post_meta';
$mf_metas = $wpdb->get_results("SELECT * FROM $table WHERE post_id = $master_post_id");
foreach($mf_metas as $mf_meta){
$master_meta_id = $mf_meta->meta_id;
$master_meta_value = $wpdb->get_var( $wpdb->prepare("SELECT meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s LIMIT 1 OFFSET %d", $master_post_id, $mf_meta->field_name, $mf_meta->group_count - 1) ); //check since there may be multiple instances
@rodw
rodw / backup-github.sh
Last active May 15, 2024 02:33
A simple script to backup an organization's GitHub repositories, wikis and issues.
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
#-------------------------------------------------------------------------------
# NOTES:
#-------------------------------------------------------------------------------
# * Under the heading "CONFIG" below you'll find a number of configuration
# parameters that must be personalized for your GitHub account and org.
# Replace the `<CHANGE-ME>` strings with the value described in the comments
# (or overwrite those values at run-time by providing environment variables).
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@smottt
smottt / AcmeCommand.php
Created March 31, 2012 12:15
Quick tip for setting the correct host in your custom symfony2 command.
<?php
namespace Acme\DemoBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class AcmeCommand extends ContainerAwareCommand
{