Skip to content

Instantly share code, notes, and snippets.

View ccamara's full-sized avatar

Carlos Cámara ccamara

View GitHub Profile
#!/bin/sh
# Install Command line tools (requires Xcode from app store)
xcode-select --install
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
mkdir ~/bin
mkdir ~/.composer
mkdir -p ~/.vim/swaps
/*! jQuery v1.7.2 jquery.com | jquery.org/license */
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j
@ccamara
ccamara / page.tpl.php
Last active August 29, 2015 14:01
matchHeight makes the height of all selected elements exactly equal. #equal-height #jquery See: http://brm.io/jquery-match-height/ for more info
<script src="jquery.matchHeight.js" type="text/javascript"></script>
@ccamara
ccamara / template.php
Last active August 29, 2015 13:57 — forked from gionn/gist:2308768
Modifying #drupal #search-form
<?php
function theme_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'search_block_form') {
$form['search_block_form']['#title'] = t('Search'); // Change the text on the label element
$form['search_block_form']['#title_display'] = 'invisible'; // Toggle label visibilty
//$form['search_block_form']['#size'] = 40; // define size of the textfield
$form['search_block_form']['#default_value'] = t('Search'); // Set a default value for the textfield
//$form['actions']['submit']['#value'] = t('GO!'); // Change the text on the submit button
$form['actions']['submit']['#value'] = decode_entities('&#61442;'); // Uses a unicode code (eg. useful when using awesomefonts)
//$form['actions']['submit'] = array('#type' => 'image_button', '#src' => base_path() . path_to_theme() . '/immagini/btnCerca.png'); // Adds an image
@ccamara
ccamara / yourmodule.module
Last active January 3, 2016 02:39
Programatically creation of nodes in #Drupal7
<?php
/**
* Creates 'nodetype' pages.
*
* @param array $content
* Assoc array with machine names as key and node title.
*/
function yourmodule_create_nodetype($content) {
foreach ($content as $machine_name => $content_item) {
@ccamara
ccamara / .bash_profile
Last active December 31, 2015 14:49 — forked from modcab/gist:8002917
Aguasingas' .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
@ccamara
ccamara / images.scss
Last active December 30, 2015 03:49
if we are using images in #compass there's no need of using a full url path to them. We can use image-url() instead #css #scss #sass
.background-image {
background: image-url('image-name.png'); //image-url() is defined in config.rb file so its prefered
}
@ccamara
ccamara / nth-element.css
Created November 11, 2013 09:53
#CSS nth-element pseudo selector
//More info: http://css-tricks.com/how-nth-child-works/
ul li:nth-child(3n+3) {
color: #ccc;
}
ul li:nth-child(5) {
color: #ccc;
}
@ccamara
ccamara / drush.commands.sh
Last active December 26, 2015 03:38
#drush commands for files and databases #syncronization
# Creates a copy of current database, deletes it and syncs it with dev
drush ard && drush sql-drop && drush sql-sync @site.dev @site.local
# Sync files
drush rsync @site.dev:%files @site.local:%files
@ccamara
ccamara / drush.sh
Last active December 25, 2015 16:29
Simple #drush command to find which modules implement a certain #hook #drupal
drush php-eval 'print_r(module_implements("hook_name"))'