Skip to content

Instantly share code, notes, and snippets.

go.ugotsta.com Ugotsta

Block or report user

Report or block Ugotsta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Ugotsta
Ugotsta / ugotsta_amazon_search_shortcode.php
Last active Dec 17, 2015
WordPress shortcode to easily link to Amazon search results with associate id. Includes security considerations as well as defaults to make it as simple as possible to use.
View ugotsta_amazon_search_shortcode.php
<?php
// Shortcode to easily link to Amazon search results with associate id.
// Use:
// [amazon-search search="WordPress"]WordPress[/amazon-search]
// [amazon-search search="WordPress"]
// [amazon-search search="WordPress" id="my-id"]WordPress Search on Amazon[/amazon-search]
function ugotsta_amazon_search_shortcode($search, $content = null ) {
// get attributes
extract(shortcode_atts(array(
@Ugotsta
Ugotsta / clear-tape.css
Created Jun 3, 2013
Simple CSS to simulate slightly opaque, clear tape, using dotted borders for serrated edges.
View clear-tape.css
.clear-tape {
/* Slightly opaque background */
background-color: rgba(255,255,255,0.5);
/* Dark, slightly opaque border */
border: 1px solid rgba(0,0,0,0.5);
/* Dotted side borders to simulate serrated edges */
border-left: 2px dotted rgba(0,0,0,0.2);
border-right: 2px dotted rgba(0,0,0,0.2);
/* Very slight shadow */
box-shadow: 0px 0px 4px rgba(0,0,0,0.2);
@Ugotsta
Ugotsta / replace_first_occurrence.php
Last active Dec 18, 2015
WordPress snippet to replace first occurrence of a string with another within post content, relying on the_content filter and the PHP preg_replace function. In this example, the first occurence of "WordPress" is being replaced with a link to wordpress.org. The last parameter on line 4 restricts the replacement to only the first occurrence.
View replace_first_occurrence.php
<?php
function replace_content($content)
{
$content = preg_replace('/WordPress/', '<a href="http://wordpress.org/">WordPress</a>', $content, 1);
return $content;
}
add_filter('the_content','replace_content');
?>
@Ugotsta
Ugotsta / keypress.css
Created Jun 16, 2013
Simple way to highlight keypress or key combinations with CSS. Just add a <span> with a "keypress" class to the relevant text.
View keypress.css
/*
Simple way to highlight keypress or key combinations with CSS.
Just add a <span> with a "keypress" class to the relevant text.
example: Press <span class="keypress">Ctrl-C</span> to copy.
*/
span.keypress {
/* for use with white background */
border: 1px solid #000;
@Ugotsta
Ugotsta / change-tagline-daily.php
Created Jul 5, 2013
WordPress snippet to automatically change site tagline(blog description) once a day to a random item from an array. Relies on wp_schedule_event and WordPress action hooks.
View change-tagline-daily.php
<?
// create new schedule_change action hook
add_action('schedule_change', 'change_description');
// function to schedule event if it doesn't exist
function activate_change() {
// check if schedule_change action/event already exists
if ( !wp_next_scheduled( 'schedule_change' ) ) {
// schedule new event to trigger schedule_change daily
wp_schedule_event( time(), 'daily', 'schedule_change');
@Ugotsta
Ugotsta / marketpress-global-product-grid.css
Created Sep 4, 2013
CSS for the MarketPress e-Commerce plugin for WordPress to display products in a 3-column grid format.
View marketpress-global-product-grid.css
div#mp_product_list .product {
display: inline;
float: left;
width: 29%;
margin: 2%;
}
div#mp_product_list .product:nth-child(3n+1) {
clear: both;
}
@Ugotsta
Ugotsta / rwpaint_scanlines.js
Created Sep 18, 2013
Simple scanline effect for RealWorld Paint, usable as a layer style or effect via the JavaScript layer style or custom operation effect. The effect can be horizontal, vertical or both using the scanline_x and scanline_y variables and the alpha value of the effect can be adjusted with scanline_alpha.
View rwpaint_scanlines.js
var img = Document.RasterImage;
var sizeX = img.sizeX;
var sizeY = img.sizeY;
var scanline_x = 2;
var scanline_y = 0;
var scanline_alpha = 0;
for (var x = 0; x < sizeX; x += 1) {
for (var y = 0; y < sizeY; y += 1) {
if (x%scanline_x === 0) {
@Ugotsta
Ugotsta / future-pinball-video.ahk
Last active Dec 23, 2015
Autohotkey script to load and run user-selected Future Pinball tables for video recording and screen capture purposes. Designed to work alongside MSI Afterburner for video and screen captures.
View future-pinball-video.ahk
;Autohotkey script to load and run user-selected Future Pinball tables
;for video recording and screen capture purposes
#NoEnv
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
DetectHiddenWindows On
#WinActivateForce
@Ugotsta
Ugotsta / buddypress-exclude-category-slugs-from-activity-stream.php
Created Oct 21, 2013
Simple plugin for WordPress Multi-site and BuddyPress to restrict categories, by slug, from the Activity Stream. It's a Multi-site plugin, meant to be installed in wp-content/mu-plugins.
View buddypress-exclude-category-slugs-from-activity-stream.php
<?php
/*
Simple, Multi-site plugin for WordPress and BuddyPress to restrict categories, by slug, from the Activity Stream
Please note, his is a Multi-site plugin meant to be installed in wp-content/mu-plugins/ folder in a Multi-site WordPress install
code derivative of snippet by imath at:
http://buddypress.org/support/topic/possible-to-exclude-post-categories-in-activity-stream-and-make-a-user-profile-private-like-with-pri/
*/
function exclude_category_slugs_from_activity_stream( $post_id, $post ){
@Ugotsta
Ugotsta / chat-template.php
Created Jul 21, 2014
Very simple, relatively empty page template for use with WPMU DEV Chat plugin to facilitate chats in popup window.
View chat-template.php
<?php
/**
Template Name: Chat Template
*/
?>
<html>
<head>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<style type="text/css">
You can’t perform that action at this time.