Question?
Answer
# Example use: find commit messages that contain pattern1 and pattern2 | |
# $ git grepwords pattern1 pattern2 | |
# Ensure we have at least one param (a pattern) | |
[ -n "$1" ] || { echo "usage: $0 PATTERN..." >&2; exit 1; } | |
pattern="" | |
# Append all remaining patterns | |
while [ -n "$1" ]; do |
drush dl drupal \ | |
--destination=/Applications/MAMP/htdocs \ | |
--drupal-project-rename=d7 | |
cd /Applications/MAMP/htdocs/d7 | |
drush site-install standard \ | |
--db-url="mysql://root:root@localhost/d7"\ | |
--site-name="d7" |
#! /usr/bin/env bash | |
PROBLEM="$(cat /etc/hosts | grep tableausoftware.com | grep -v '^#' | wc -w)" | |
SAY=${1:-"omg fix yer hosts"} | |
if [ "$PROBLEM" -gt 0 ]; then | |
say $SAY | |
fi |
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist' | |
alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist' | |
alias nginx.restart='nginx.stop && nginx.start' | |
alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php53.plist" | |
alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php53.plist" | |
alias php-fpm.restart='php-fpm.stop && php-fpm.start' | |
alias mysql.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist" | |
alias mysql.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist" |
<?php | |
/** | |
* Suggested by mikeytown2 for faster DB | |
* @see https://www.drupal.org/node/1650930#comment-8437127 | |
*/ | |
/* -- Delete this line if you want to use this | |
$databases['default']['default']['init_commands'] = array( | |
'isolation' => "SET SESSION tx_isolation='READ-COMMITTED'" | |
); |
<?php | |
//assuming $node exists | |
$my_collection = entity_create('field_collection_item', array('field_name' => 'field_my_collection')); | |
$my_collection->setHostEntity('node', $node); | |
$my_collection->field_text_data[LANGUAGE_NONE][0]['value'] = "hello"; | |
$my_collection->field_term_ref[LANGUAGE_NONE][0]['tid'] = 123; | |
$my_collection->field_node_ref[LANGUAGE_NONE][0]['target_id'] = 345; | |
$my_collection->save(); | |
node_save($node); |
<div class="gallery-item"> | |
</div> | |
<div class="gallery-item"> | |
</div> | |
<div class="gallery-item"> | |
</div> |
(function () { | |
////////////////////////////// | |
// Add event (cross browser) | |
// From http://stackoverflow.com/a/10150042 | |
////////////////////////////// | |
function addEvent(elem, event, fn) { | |
if (elem.addEventListener) { | |
elem.addEventListener(event, fn, false); | |
} else { | |
elem.attachEvent('on' + event, function() { |
// Cross-scope compatible placeholder boilerplate. | |
@mixin my-mixin($extend: true) { | |
@if $extend { | |
@extend %my-mixin; | |
} | |
@else { | |
// Mixin core | |
} | |
} |