Skip to content

Instantly share code, notes, and snippets.

@dcavins
dcavins / bp_docs_unlink.2.patch
Created March 4, 2015 16:06
Unlink BP Docs from Groups
@dcavins
dcavins / bp_docs_unlink.1.patch
Created March 4, 2015 01:57
Unlink BP Docs from Groups
@dcavins
dcavins / regexp-remove-prepositions
Last active May 30, 2023 21:02
RegExp for finding articles and prepositions in a string
<?php
$needles = array( 'a', 'an', 'the', 'and', 'or', 'but', 'aboard', 'about', 'above', 'across', 'after', 'against', 'along', 'amid', 'among', 'anti', 'around', 'as', 'at', 'before', 'behind', 'below', 'beneath', 'beside', 'besides', 'between', 'beyond', 'but', 'by', 'concerning', 'considering', 'despite', 'down', 'during', 'except', 'excepting', 'excluding', 'following', 'for', 'from', 'in', 'inside', 'into', 'like', 'minus', 'near', 'of', 'off', 'on', 'onto', 'opposite', 'outside', 'over', 'past', 'per', 'plus', 'regarding', 'round', 'save', 'since', 'than', 'through', 'to', 'toward', 'towards', 'under', 'underneath', 'unlike', 'until', 'up', 'upon', 'versus', 'via', 'with', 'within', 'without', 'long' );
$needles = implode('|', $needles);
// ?: signifies a non-capturing group
// http://www.regular-expressions.info/captureall.html
$pattern = "/(?:(?:\b(?:$needles)\b(?:\W(?:$needles)\b)*))/";
$haystack = 'By the Light of the Silvery Moon and Stars except during or until Dawn';
$replacement = '(r)$0(/r)';
@dcavins
dcavins / admin.css
Created December 28, 2014 16:02
BP Core Admin CSS
/**
* Markup for the BuddyPress wp-admin screens.
*/
.bpa-nav-logo:before {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; }
.bpa-header {
border-bottom: 1px solid #e44800;;
}
@dcavins
dcavins / two-thirds-block-example.html
Last active February 21, 2017 16:35
Two-thirds-block structure example
<div class="content-row clear">
<div class="third-block spans-2">
Suddenly she came upon a little three-legged table, all made of solid glass; there was nothing on it except a tiny golden key, and Alice's first thought was that it might belong to one of the doors of the hall.
</div>
<div class="third-block">
Suddenly she came upon a little three-legged table, all made of solid glass; there was nothing on it except a tiny golden key.
</div>
</div>
@dcavins
dcavins / quarter-block-example.html
Last active February 21, 2017 16:35
Quarter-block structure example
<div class="content-row clear">
<div class="quarter-block">
Suddenly she came upon a little three-legged table...
</div>
<div class="quarter-block">
Suddenly she came upon a little three-legged table...
</div>
<div class="quarter-block">
Suddenly she came upon a little three-legged table...
</div>
@dcavins
dcavins / third-block-example.html
Last active February 21, 2017 16:35
Third-block structure example
<div class="content-row clear">
<div class="third-block">
Suddenly she came upon a little three-legged table...
</div>
<div class="third-block">
Suddenly she came upon a little three-legged table...
</div>
<div class="third-block">
Suddenly she came upon a little three-legged table...
</div>
@dcavins
dcavins / half-block-example.html
Last active February 21, 2017 16:36
Half-block structure example
<div class="content-row clear">
<div class="half-block">
Suddenly she came upon a little three-legged table...
</div>
<div class="half-block">
Suddenly she came upon a little three-legged table...
</div>
</div>