Skip to content

Instantly share code, notes, and snippets.

@mordonez
mordonez / ymbra_menu_images.module
Created February 28, 2012 10:08
Drupal 7: Adding images for menu items using attributes
<?php
/**
* @file
*
*/
/**
* Implements hook_form_BASE_FORM_ID_alter().
*
* Adds menu item fields to the node form.
@mordonez
mordonez / gist:1934390
Created February 28, 2012 18:59
htpasswd
htpasswd -cb .htpasswd username password
@mordonez
mordonez / dabblet.css
Created March 20, 2012 09:33
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@mordonez
mordonez / dabblet.css
Created March 20, 2012 09:38
CSS States
/* CSS States */
body {
background: url(http://dabblet.com/img/noise.png);
background-color: #F5F2F0;
font-family: Georgia, serif;
font-size: 18px;
line-height: 1.6em;
text-shadow: 0 2px 0 white;
color: #222;
}
@mordonez
mordonez / dabblet.css
Created March 20, 2012 09:39
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@charset "UTF-8";
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
margin: 0;
padding: 0;
border: 0;
@mordonez
mordonez / gist:2158606
Created March 22, 2012 14:24
commerce: quantity block
/**
* Implements hook_block_info().
*
* This hook declares what blocks are provided by the module.
*/
function stock_block_info() {
$blocks['cart_quantity'] = array(
'info' => t('Cart Quantiy'),
'status' => TRUE,
);
@mordonez
mordonez / remove_files_recursive.txt
Created September 17, 2012 16:14
Linux or Unix find and remove files on fly
Linux or Unix find and remove files with one find command on fly
find . -name "FILE-TO-FIND"-exec rm -rf {} \;
find . -type f -name "FILE-TO-FIND" -exec rm -f {} \;
@mordonez
mordonez / gist:4160654
Created November 28, 2012 11:41
Drupal: Update user field
# with Entity API
$user = user_load('uidXXX');
$obj = entity_metadata_wrapper('user', $user);
$obj->field_XXX = 'blah';
$obj->save();
# Other way
$existing = user_load('uidXXX');
@mordonez
mordonez / dropTablesConsole
Created November 30, 2012 11:21
Drop all tables in a MySQL database
; Source http://www.thingy-ma-jig.co.uk/blog/10-10-2006/mysql-drop-all-tables
mysqldump -u[USERNAME] -p[PASSWORD] --add-drop-table --no-data [DATABASE] | grep ^DROP | mysql -u[USERNAME] -p[PASSWORD] [DATABASE]