Skip to content

Instantly share code, notes, and snippets.

View modcab's full-sized avatar

Modesto Caballero modcab

  • Modlabs IT Solutions
  • London, UK
View GitHub Profile
@modcab
modcab / gist:8002917
Last active December 31, 2015 14:49
My .bash_profile, with some git goodness.
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
# Autocompletion for git.
# http://code-worrier.com/blog/autocomplete-git/
# Download doing curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
@modcab
modcab / gist:94e953fca4ef0bafa200
Last active December 8, 2015 14:08
Setup for XDebug remote debugging
; you should include this on xdebug.ini
; got it from http://www.sitepoint.com/install-xdebug-phpstorm-vagrant/
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.idekey = "PHPSTORM"
xdebug.max_nesting_level = 10000
; only if you want xdebug to trigger ALWAYS
xdebug.remote_autostart = on
@modcab
modcab / gist:affaf102a9c43d7153ce
Created March 9, 2015 09:38
[Bitbucket] Check out a pull request branch before merging it
# Got it from http://www.electricmonk.nl/log/2014/03/31/test-a-pull-merge-request-before-accepting-on-bitbucket/
git fetch https://bitbucket.org/user/repo branch
git checkout FETCH_HEAD
@modcab
modcab / gist:54972e9d46a85b9e3647
Created March 19, 2015 14:47
Example of notification message for Jenkins Notification Plugin
{
"name": "asgard",
"url": "job/asgard/",
"build": {
"full_url": "http://localhost:8080/job/asgard/18/",
"number": 18,
"phase": "COMPLETED",
"status": "SUCCESS",
"url": "job/asgard/18/",
"scm": {
drush vset theme_debug 1
@modcab
modcab / script.js
Last active March 10, 2016 12:58
jQuery - Make video in iframe responsive
// Makes iframes inside of a node body responsive.
Drupal.behaviors.responsive_iframes = {
attach: function (context) {
$(document).ready(function() {
// Iframe needs to have the class .responsive.
$('.field-name-body iframe').each(function(index, value) {
// Height and width both need int values.
var height = parseInt($(this).attr('height')) || null;
var width = parseInt($(this).attr('width')) || null;
if ((height !== null) && (width !== null)) {
@modcab
modcab / drupal views alter items per page
Created May 27, 2016 08:51 — forked from toleillo/drupal views alter items per page
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;
}
@modcab
modcab / module.php
Created June 2, 2016 10:21
Drupal 7 - Programmatically create children menu items in different languages.
function sega_hero_update_7001() {
// Load all 'Mobile' menu items in the different languages.
$parent_menu_items = db_select('menu_links', 'l')
->fields('l')
->condition('link_title', 'Mobile')
->condition('menu_name', 'main-menu')
->execute()
-> fetchAllAssoc('language');
// Children menu items we're going to create.
@modcab
modcab / style.css
Created June 7, 2016 13:20
Replace text with FontAwesome icon
.flex-control-nav a
{
visibility: hidden;
}
.flex-control-nav a:before {
visibility: visible;
font-family: FontAwesome;
font-size: 30px;
display: inline-block;
content: '\f137';
@modcab
modcab / style.css
Created June 7, 2016 13:21
Add FontAwesome content to CSS class
a:before {
font-family: FontAwesome;
content: "\f095";
display: inline-block;
padding-right: 3px;
vertical-align: middle;
}