Skip to content

Instantly share code, notes, and snippets.

View froboy's full-sized avatar

Avi Schwab froboy

View GitHub Profile
@froboy
froboy / gist:11222175
Created April 23, 2014 16:23
PHP snippet for Drupal Views Bulk Operations to remove a selected taxonomy term from multiple nodes
$bad_tid = 0; // Enter the term id you wish to remove
foreach($entity->field_tags['und'] as $key => $term) {
if($term['tid'] == $bad_tid) unset ($entity->field_tags['und'][$key]);
}
node_save($entity);
@froboy
froboy / keybase.md
Created August 14, 2014 18:11
Keybase proof

Keybase proof

I hereby claim:

  • I am froboy on github.
  • I am froboy (https://keybase.io/froboy) on keybase.
  • I have a public key whose fingerprint is 28B1 F319 482F 148B 3385 6785 4998 8F44 9B45 9225

To claim this, I am signing this object:

@froboy
froboy / _colors.scss
Created July 29, 2015 21:30
UChicago Identity Colors SASS variables
// Once you have a SASS project set up, include this file
// with '@import “_colors.scss”;' and then use the variables
// in your SCSS files like 'a { color: $maroon; }'.
//primary color palette
$maroon: #800000;
$darkgray: #767676;
$lightgray: #D6D6CE;
//secondary color palette
@froboy
froboy / slack_settings
Last active December 5, 2022 09:23 — forked from grasmash/ slack_settings
Acquia Cloud Slack integration
TOKEN=obfuscation
SLACK_WEBHOOK_URL=https://yoursite.slack.com/services/hooks/incoming-webhook?token=$TOKEN
CLOUD_SITE=1234567
@froboy
froboy / How to clear caches
Created June 2, 2016 15:35
Official documentation on how to clear caches in major browsers—for pasting into client emails, documentation, etc.
How to clear caches in major browsers:
- Firefox: https://support.mozilla.org/en-US/kb/how-clear-firefox-cache
- Google Chrome: https://support.google.com/chrome/answer/95582?hl=en
- Safari: https://support.apple.com/kb/PH21412?viewlocale=en_US&locale=en_US
- Microsoft Internet Explorer (Windows 9 or lower): http://windows.microsoft.com/en-us/windows7/how-to-delete-your-browsing-history-in-internet-explorer-9
- Microsoft Edge (Windows 10): http://windows.microsoft.com/en-us/windows-10/view-delete-browsing-history-microsoft-edge
- Opera: http://help.opera.com/Windows/12.10/en/cache.html
@froboy
froboy / getsite.txt
Created June 28, 2016 14:49
Grab an entire static archive of a site with wget
// Before you can do this, get http://brew.sh/
// Then get wget: brew install wget
//
// Grab an entire static archive of a site. (This might take a while)
wget -mkEpnp http://sitename.com
@froboy
froboy / vbo-snippet.php
Created April 19, 2017 20:08
Drupal (7) VBO snippet - Turn on pathauto & Remove redirects
// This script can be run via Views Bulk Operations in the "Execute arbitrary PHP code" op
// This is, obviously, at your own risk. I'd take a db backup first.
// Force "Generate alias automatically" to be TRUE, then save the node.
$entity->path['pathauto'] = TRUE;
node_save($entity);
// Remove any stray redirects so that there's one true URL
$deleted = db_delete('redirect')
->condition('redirect', 'node/' . $entity->nid)
->execute();
@froboy
froboy / nucular-option.sh
Last active May 19, 2022 19:15
Sometimes composer (in your Drupal 8 environment) gets grupmy... when that happens, it's time to go nucular.
######
# This script intentionally deletes a lot of things that could be important!!!!!
# Please be sure you have a backup before you go nucular!!!!!
#####
# Depending on where your web root is...
rm -rf vendor/ && rm -rf web/core && rm -rf web/modules/contrib/ && rm -rf composer.lock
# or
rm -rf vendor/ && rm -rf docroot/core && rm -rf docroot/modules/contrib/ && rm -rf composer.lock
@froboy
froboy / sites.php
Created November 15, 2017 15:34
If you have a Drupal multisite with predictable hostnames, use this to keep your sites.php lean.
<?php
$sites['somecustomsitename.com'] = 'somecustomsite.com';
if (strpos($_SERVER['HTTP_HOST'], "-ra") != FALSE) // somesite-ra.com
{
$sites[$_SERVER['HTTP_HOST']] = // Cut out -ra and rewrite to somesite.com
str_replace("-ra", "", $_SERVER['HTTP_HOST']);
}