Skip to content

Instantly share code, notes, and snippets.

@robhurring
robhurring / bash_aliases.sh
Created November 22, 2010 19:48
Fun with OpenSSL encryption
# Put this somehwere in .bashrc/aliases/etc.
# OpenSSL must be installed -- these are just aliases.
alias enc='openssl enc -e -aes-256-cbc -salt '
alias dec='openssl enc -d -aes-256-cbc '
@charlieschwabacher
charlieschwabacher / mixins.scss
Created July 21, 2011 07:41
SCSS mixins for cross browser CSS3 border-radius, transition, gradient, and box shadow
//Cross browser CSS3 mixins
@mixin box-shadow($left, $top, $radius, $color) {
box-shadow: $left $top $radius $color;
-webkit-box-shadow: $left $top $radius $color;
-moz-box-shadow: $left $top $radius $color;
}
@mixin transition($property, $duration, $easing: linear) {
transition: $property $duration $easing;
@jonathonbyrdziak
jonathonbyrdziak / CustomWidgetFile.php
Last active September 29, 2022 22:00
EMPTY WIDGET Plugin code to create a single widget in wordpress.
<?php
/**
* Duplicate this file as many times as you would like, just be sure to change the
* Empty_Widget class name to a custom name of your choice. Have fun! redrokk.com
*
* Plugin Name: Empty Widget
* Description: Single Widget Class handles all of the widget responsibility, all that you need to do is create the html. Just use Find/Replace on the Contact_RedRokk_Widget keyword to rebrand this class for your needs.
* Author: RedRokk Interactive Media
* Version: 1.0.0
* Author URI: http://www.redrokk.com
@chrisguitarguy
chrisguitarguy / cpt-permalinks.php
Created October 10, 2011 17:28
How to add fields to the WordPress permalinks page
@artofhuman
artofhuman / sum_arrays.php
Created April 22, 2012 08:35
sum arrays by keys
function array_mesh() {
// Combine multiple associative arrays and sum the values for any common keys
// The function can accept any number of arrays as arguments
// The values must be numeric or the summed value will be 0
// Get the number of arguments being passed
$numargs = func_num_args();
// Save the arguments to an array
@zanematthew
zanematthew / routes.php
Created June 19, 2012 02:48
Custom routes for using WordPress as an Application
<?php
/**
* This file handles redirecting of our templates to our given views
* dir and anything else.
*
* Check if the themer has made a theme file in their
* theme dir, if not load our default.
*
* @uses template_redirect http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect
*/
@letanure
letanure / estados-cidades.json
Last active May 13, 2024 13:51
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@jcanfield
jcanfield / index.php5
Last active June 25, 2020 22:56
Wordpress Image Attachment Recipes > Post by DigWP.com which can be found at http://digwp.com/2009/08/awesome-image-attachment-recipes-for-wordpress/. > Even though this is an older post there are a few very simple Wordpress functions and methods utilizing Post Images with-in your code.
/*****
* Basic display of gallery attachments
* When displaying your images via the [gallery] shortcode, WordPress will display image-links for each image in the gallery. Each of these image-links points to the image-gallery page for that particular image. The image gallery is created by the image.php template if present in your theme files. Here is a basic way to display your gallery images from within the image-gallery loop:
*****/
<a href="<?php echo wp_get_attachment_url($post->ID); ?>"><?php echo wp_get_attachment_image($post->ID, 'medium'); ?></a>
/*****
* Display the URL of the latest image attachment
* Perhaps the most useful template tag for displaying image-attachment information is wp_get_attachment_url(). This function returns a full URI for an attachment file. If no attachment is found, a value of false is returned. Here are several ways to use this tag within the loop:
@schjetne
schjetne / back-with-fallback.js
Created April 24, 2013 12:12
Code to navigate to previous page in history if it exists, otherwise go back to a default "back" location.
// Use: ><a href="list.html" class="js-back">Go back</a>
$('.js-back').on('click', function(evt) {
if (document.referrer != "") {
evt.preventDefault();
history.back();
}
});