Skip to content

Instantly share code, notes, and snippets.

View mdeltito's full-sized avatar
🥨

Mike Del Tito mdeltito

🥨
View GitHub Profile
# update PS1 to include git branch
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[$(tput setaf 3)\]$(__git_ps1)\[$(tput setaf 7)\]$ '
# Make a copy of sprites with a name that has no uniqueness of the hash.
on_sprite_saved do |filename|
if File.exists?(filename)
FileUtils.mv filename, filename.gsub(%r{-s[a-z0-9]{10}\.png$}, '.png')
end
end
# Replace in stylesheets generated references to sprites
# by their counterparts without the hash uniqueness.
on_stylesheet_saved do |filename|
@mdeltito
mdeltito / gist:3249043
Created August 3, 2012 16:08
Vertical Rhythm issue
/* SCSS */
$base-font-size: 16px;
$base-line-height: 24px;
@import "compass/typography/vertical_rhythm";
@include establish-baseline;
#content {
@include adjust-font-size-to(13px);
}
@function em($target-size-in-px, $px-context: $base-font-size){
@return #{$target-size-in-px/$px-context}em;
}
@mixin section-flag($color: $accent-blue) {
background: $color;
position: absolute;
top: 0;
left: 0;
margin: 0;
@mdeltito
mdeltito / report.module
Created December 17, 2013 21:10
adding profile2 entity form fields to a node form
<?php
/**
* implements hook_form_FORM_ID_alter
*/
function report_form_node_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'report_node_form') {
// the node author's uid is always available here
$account = user_load($form['#node']->uid);
@mdeltito
mdeltito / httpdir.rb
Created January 9, 2014 04:06
httpdir: run a webrick webserver from any directory to serve anything.
#!/usr/bin/env ruby
require 'webrick'
require 'optparse'
include WEBrick
options = {
port: (12000 + (Dir::pwd.hash % 1000)),
dir: Dir::pwd
}
@mdeltito
mdeltito / drush-fu-match.sh
Created August 1, 2014 05:07
update all features matching a pattern
drush fu | grep <pattern> | while read line; do drush fu -y "$line"; done

Gem a Ruby gem is a package that contains information and files. Cucumber, and RSpec are the gems I currently have.

When I need to install a new gem, I go into my Gemfile in any text editor (Sublime, Vim, etc ;) ) and add the gem and version I want to be used. For example, the latest version of Cucumber is 1.3.16, but I've specified that I want to use 1.2.1. Then I run bundle install to ensure those versions are installed, which also updates my Gemfile.lock

gem list - I can run this command to see a list of local gems, and the versions available

After adding a new gem to my Gemfile, run the following commands:

bundle install - Install the dependencies specified in your Gemfile

#!/bin/bash
NODE_VERSION='0.10'
RUBY_VERSION='2.0.0-p481'
if [ ! -d ~/.nvm ]; then
echo "Installing nvm..."
git clone https://github.com/creationix/nvm.git ~/.nvm
echo -e "\n# nvm\n source ~/.nvm/nvm.sh" >> ~/.bash_profile
fi
diff --git a/menu_block.admin.inc b/menu_block.admin.inc
index 992a0cc..2236d1a 100644
--- a/menu_block.admin.inc
+++ b/menu_block.admin.inc
@@ -164,6 +164,7 @@ function menu_block_delete_submit($form, &$form_state) {
variable_del("menu_block_{$delta}_level");
variable_del("menu_block_{$delta}_follow");
variable_del("menu_block_{$delta}_depth");
+ variable_del("menu_block_{$delta}_relative");
variable_del("menu_block_{$delta}_expanded");