Skip to content

Instantly share code, notes, and snippets.

View tammyhart's full-sized avatar

Tammy Hart tammyhart

View GitHub Profile
@lgedeon
lgedeon / gist:3784555
Created September 25, 2012 21:24
HTML Excerpt
function plugin_trim_by_characters_with_html( $text, $length = 400, $append = ' &hellip;', $allowable_tags = '<b><em><a>' ) {
$length = (int) $length;
$text = trim( strip_tags( $text, $allowable_tags ) );
$in_quote = false;
// if the length without tags is less than our target we are done
if ( strlen( strip_tags( $text ) ) <= $length )
return $text;
// count forward to find the $length character in unstripped $text not counting tags
for ($i = 0, $j = 0, $l = strlen( $text ), $in_tag = false; $i < $l && ( $in_tag || $j < $length ); $i++) :
switch ( $text[$i] ) :
@germanny
germanny / _instructions.md
Last active May 24, 2024 17:44 — forked from jimmynotjim/_instructions.md
Instructions for setting up OSX

Setup OSX with a Clean Install

About once a year, my machine gets pretty sluggish and it's time to start fresh. Here's the process I use to update it with everything I need.

TODO: Add info about dotfiles set up and zsh (possible settings file?)

  • Save all dotfiles to a repo for easy transfer
  • Back up all photos, music, apps, iTunes library, keychains, etc.
<?php
/*
* Plugin Name: Category Home Page
* Plugin URI: trepmal.com
* Description:
* Version:
* Author: Kailey Lampert
* Author URI: kaileylampert.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@certainlyakey
certainlyakey / library.scss
Last active July 25, 2024 03:37
URL-encode color SASS function / convert color to hex SASS function
//does not work with colors containing alpha
@function encodecolor($string) {
@if type-of($string) == 'color' {
$hex: str-slice(ie-hex-str($string), 4);
$string:unquote("#{$hex}");
}
$string: '%23' + $string;
@return $string;
}