Skip to content

Instantly share code, notes, and snippets.

View toleillo's full-sized avatar

Juan Pastor toleillo

View GitHub Profile

You can check here for getting the latest version. Change the wget url to download newer versions.

$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ cd wkhtmltox/bin/
$ sudo mv wkhtmltopdf /usr/bin/wkhtmltopdf
$ sudo mv wkhtmltoimage /usr/bin/wkhtmltoimage
$ sudo chmod a+x /usr/bin/wkhtmltopdf
@toleillo
toleillo / gist:d1709e01766c8eedcc2f8217bf486639
Created May 16, 2018 14:41 — forked from rmatil/gist:8d21620c11039a442964
Connect MySQL database in Vagrant VM from Host machine

Connecting to Vagrant VM MySQL database from host

This gist shows how to connect to your vagrant MySQL database from the host machine.

Change Address Binding from MySQL

  • Connect to vagrant using vagrant ssh
  • Edit file /etc/mysql/my.cnf:
    • Change parameter bind-address to 0.0.0.0 to allow all incoming connection attempts
@toleillo
toleillo / iecisaApi.php
Created October 26, 2016 09:38
Class for MAC generation on IECISA Secure payment
<?php
/**
* Class IecisaApi
*
* MAC generation for IECISA secure payment.
*
* $message = CF_XtnType + CF_User + CF_Date + CF_Time + CF_Amount +CF_Currency + CF_TicketNumber + CF_Lang
*
* Example usage:
@toleillo
toleillo / gist:8557877
Created January 22, 2014 12:26
Get the context blocks for region.
$reaction = context_get_plugin('reaction', 'block');
$vars['BLOCK_REGION_NAME'] = $reaction->block_get_blocks_by_region('BLOCK_REGION_NAME');
@toleillo
toleillo / gist:7927265
Created December 12, 2013 12:29
Drupal 7 fix image styles with symlink folders (patch)
Posted by RunePhilosof http://drupal.org/user/629892 October 1, 2013 at 8:06am => https://drupal.org/comment/5207924#comment-5207924
diff --git a/includes/stream_wrappers.inc b/includes/stream_wrappers.inc
index 3050739..15fd0f7 100644
--- a/includes/stream_wrappers.inc
+++ b/includes/stream_wrappers.inc
@@ -373,17 +373,29 @@ abstract class DrupalLocalStreamWrapper implements DrupalStreamWrapperInterface
if (!isset($uri)) {
$uri = $this->uri;
}
@toleillo
toleillo / gist:7926957
Created December 12, 2013 11:58
Drupal 7 update all image URLs
UPDATE file_managed SET uri = replace(uri, 'public://','new://');
@toleillo
toleillo / fix-codification-filenames
Last active December 31, 2015 03:09
Fix bad codification filenames with special chars in GNU/Linux Distros.
1 - Install convmv package
Ex: Debian | sudo apt-get install convmv
2 - Rename invalid filenames and convert to UTF-8 encoding
find . -name '?' | xargs convmv -r --notest -f cp850 -t UTF-8
@toleillo
toleillo / drupal views alter items per page
Last active May 27, 2016 08:51
Drupal Views change items per page programmatically
<?php
/**
* Implements hook_views_pre_build ()
*/
function MODULENAME_views_pre_build(&$view) {
if($view->name == "VIEWNAME") {
$view->items_per_page = 15;
}
@toleillo
toleillo / symfony2-test-command
Created November 20, 2013 14:39
Symfony2 - PHPUnit Run Tests Command
while (true) do clear; date; phpunit -c app/ src/[BundleSrc|TestFileSrc]; sleep 2; done