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
@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
{
@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.
@rodw
rodw / backup-github.sh
Last active March 30, 2024 15:04
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).
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
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;
@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)
@joelittlejohn
joelittlejohn / generate-changelog.sh
Last active March 4, 2021 18:50
Instant CHANGELOG.md from your GitHub issues
#!/usr/bin/env bash
# Generates this kind of thing:
# https://github.com/joelittlejohn/jsonschema2pojo/blob/master/CHANGELOG.md
#
# If your issue has 'breaking' label, the issue will be shown in the changelog with bold text
#
# All versions of this script are dedicated to the Public Domain, no rights reserved,
# as per https://creativecommons.org/publicdomain/zero/1.0/
#
if [ "$#" -ne 2 ]; then
@lolautruche
lolautruche / controller.php
Last active December 25, 2015 04:39
Pagination in eZ Publish 5
<?php
namespace Acme\TestBundle\Controller;
use eZ\Publish\Core\Pagination\Pagerfanta\ContentSearchAdapter;
use Pagerfanta\Pagerfanta;
use Symfony\Component\HttpFoundation\Response;
use eZ\Bundle\EzPublishCoreBundle\Controller;
use eZ\Publish\API\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier;
use eZ\Publish\API\Repository\Values\Content\Query;
@jnschulze
jnschulze / osx_ramdisk.sh
Last active February 5, 2024 13:48
Move Chrome, Safari and iTunes Cache to Ramdisk.
#!/bin/bash
# Size at the end is * 2048 where 2048 = 1 MB, so 1572864 = 768 MB
#DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://1572864`
DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://2097152`
/usr/sbin/diskutil erasevolume HFS+ "RamDiskCache" $DISK
CACHEDIR="/Volumes/RamDiskCache/$USER"
@ttscoff
ttscoff / whereami.sh
Created July 2, 2014 16:08
Uses get-location/CoreLocation on a Mac and Google's geocoding API to tell you the street address of your current location
#!/bin/bash
# So you know whoami, but whereami?
# Relies on this handy hack <https://github.com/lindes/get-location>
latlong=$(/usr/local/bin/get-location 2> /dev/null \
| sed -e 's/.*<\(.*\)>.*/\1/')
address=$(curl -Ss "http://maps.googleapis.com/maps/api/geocode/json?latlng=$latlong&sensor=false" \
| grep formatted_address \
| head -n 1 \
| sed -e 's/[ \t]*"formatted_address" : "\(.*\)",/\1/')