Skip to content

Instantly share code, notes, and snippets.

View zumwalt's full-sized avatar

Casey Zumwalt zumwalt

View GitHub Profile
@zumwalt
zumwalt / WP Random Taxonomy
Created January 25, 2013 19:31
A WordPress function for randomly showing a set number of items from a taxonomy. To use, include <?php random_tax(); ?> in your markup.
function random_tax() {
$counter = 0;
$max = 5; // Set max number of items here.
$cats ='';
$categories=get_categories();
$rand_keys = array_rand($categories, $max);
foreach ($rand_keys as $key) {
$cats .= $categories[$key]->term_id .',';
}
@zumwalt
zumwalt / hgtv-slider-conditional
Created December 5, 2012 15:38
HGTV Slider conditional
<li>
<?php if(!get_field("content_1") && (!get_field("content_2")): ?>
// Full width image code
<?php else: ?>
// Regular image code
<?php endif; ?>
</li>
&& - both things
@zumwalt
zumwalt / .zshrc
Created July 25, 2015 00:52
Bash script to open a Python server on a specified port
server() {
if [ -z "$1"]
then
python -m SimpleHTTPServer 8000
else
python -m SimpleHTTPServer $1
fi
}
@zumwalt
zumwalt / .zshrc
Created July 25, 2015 00:47
Find and kill a process using any port using a bash function
killport() {
lsof -i TCP:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9
echo "Port" $1 "killed."
}
@mixin rotated-text($num-letters: 100, $angle-span: 180deg, $angle-offset: 0deg) {
$angle-per-char: $angle-span / $num-letters;
@for $i from 1 through $num-letters {
.char#{$i} {
@include transform(rotate($angle-offset + $angle-per-char * $i));
}
}
}