Skip to content

Instantly share code, notes, and snippets.

View ewillhite's full-sized avatar

Evan Willhite ewillhite

View GitHub Profile
@ewillhite
ewillhite / Domain Access settings.php
Created December 5, 2012 17:25
Domain Access settings.php
/**
* Add the domain module setup routine.
*/
include DRUPAL_ROOT . '/sites/all/modules/domain/settings.inc';
@ewillhite
ewillhite / gist:4714694
Created February 5, 2013 14:15
Default Drupal 7 gitignore
# Ignore configuration files that may contain sensitive information.
sites/*/settings*.php
*.DS_Store
# Ignore paths that contain user-generated content.
sites/*/files
sites/*/private
@ewillhite
ewillhite / PSOD Nav
Created February 18, 2013 19:48
PSOD Nav
<ul id="nav">
<li><a href="/earn-your-osha-card">Earn Your</a>OSHA Card</li>
<span class="line"></span>
<li><a href="/course-library">Browse</a>The Library</li>
<span class="line"></span>
<li><a href="/about-ul-puresafety">About UL</a>Workplace</li>
<span class="line"></span>
<li><a href="/become-partner">Work</a>With Us</li>
<span class="line"></span>
<li><a href="/contact-our-team">Contact</a>Our Team</li>
@ewillhite
ewillhite / gist:5059672
Created February 28, 2013 20:06
File Upload
$file = file_save_upload('bg_upload');
if ($form_state['values']['bgon'] == 1) {
if ($file) {
$parts = pathinfo($file->filename);
$destination = 'public://' . $parts['basename'];
$file->status = FILE_STATUS_PERMANENT;
if(file_copy($file, $destination, FILE_EXISTS_REPLACE)) {
$_POST['bg_path'] = $form_state['values']['bg_path'] = $destination;
// If new file has a different name than the old one, delete the old
@ewillhite
ewillhite / gist:5554865
Created May 10, 2013 14:47
Simple tooltip
// News Hover
$('.view-id-news .views-field-title a').hoverIntent(function() {
var body = $(this).parents('li').children('.views-field-body');
bodyHeight = -(body.height() + 22);
body.css('top', bodyHeight);
body.show();
}, function() {
$(this).parents('li').children('.views-field-body').hide();
});
@ewillhite
ewillhite / popup.css
Created June 10, 2013 16:32
Lightbox popup
/*------------------------------------------------------------
Lightbox Stuff (replace POPUPBLOCK with name of pop-up div)
-----------------------------------------------------------*/
#overlay {
background-color: #E0E1DC;
display: none;
height: 100%;
width: 100%;
position: fixed;
top: 0;
@ewillhite
ewillhite / popup.js
Created June 10, 2013 16:33
Lightbox AJAX javascript
// Open in Lightbox when clicked
Drupal.behaviors.popupLink = function (context) {
$('LINK').click(function() {
var url = $(this).attr('href') + ' .node .content';
$('#overlay, .popup').remove();
$('<div id="overlay"></div>').appendTo('body').css('opacity','0').show().animate({opacity:.5});
$('<div class="popup"></div>').appendTo('body');
$('.popup').load(url, function() {
var topCenter = ($(window).height() - $('.popup').outerHeight()) / 2;
function qhr_menu_block_tweaks_menu_block_tree_alter(&$tree, &$config) {
foreach ($tree as $key => $item) {
if (isset($item['below'])) {
$key = current($item['below']);
if ($key['link']['link_path'] === '<view>') {
unset($key['link']['localized_options']['menu_views']);
}
}
}
}
Array
(
[49950 Consulting 511] => Array
(
[link] => Array
(
[menu_name] => main-menu
[mlid] => 511
[plid] => 0
[link_path] => node/88
@ewillhite
ewillhite / gist:6233854
Created August 14, 2013 18:16
Placeholder fallback
# ------ HTML5 Placeholder fallback ---------
unless Modernizr.input.placeholder
$("[placeholder]").focus(->
input = $(this)
if input.val() is input.attr("placeholder")
input.val ""
input.removeClass "placeholder"
).blur(->
input = $(this)
if input.val() is "" or input.val() is input.attr("placeholder")