Skip to content

Instantly share code, notes, and snippets.

@cmwelsh
cmwelsh / fancy-box-mixin.less
Created September 12, 2011 18:38
LESS: Using nesting and mixins in practice
.fancy-box(@width, @height) {
.border-radius(6px);
.box-shadow(0px, 0px, 5px, rgba(0, 0, 0, 0.5));
display: block;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.4);
width: @width - 10;
height: @height - 9;
padding: 5px 5px 4px 5px;
@cmwelsh
cmwelsh / splash.css
Created September 21, 2011 20:10
Video Container script for jQuery
* {
margin: 0;
padding: 0;
}
*:focus {
outline: none;
}
body {
@cmwelsh
cmwelsh / dropdown.js
Created September 22, 2011 16:10
JavaScript Drop Down Menu
// Header Navigation Drop Down Menu
window.jQuery(function ($) {
"use strict";
var slideDownDuration, slideUpDuration, $activationTarget, navTimers;
function activateMenu() {
var id, $this, $menu;
id = $.data(this);
@cmwelsh
cmwelsh / searchreplacedb2.php
Created September 27, 2011 20:46
PHP/MySQL: Search and replace database including serialized fields
<?php
// Safe Search and Replace on Database with Serialized Data v2.0.0
// This script is to solve the problem of doing database search and replace
// when developers have only gone and used the non-relational concept of
// serializing PHP arrays into single database columns. It will search for all
// matching data on the database and change it, even if it's within a serialized
// PHP array.
@cmwelsh
cmwelsh / navigationtabs.js
Created October 11, 2011 14:37
Navigation Tabs plugin with hooks for tab enter/exit
// Navigation tabs plugin
var navigationTabs = function($) {
var $tabSelector;
var $navigationSelector;
var animations = {};
var $activeTab = null;
var currentlyAnimating = false;
var $autoSwitchNext = null;
var navigationHashes = {};
@cmwelsh
cmwelsh / gist:1281534
Created October 12, 2011 15:32
No clicking on empty hash anchors
// Prevent empty hash anchors
$(document).delegate('a', 'click', function (e) {
if ($(this).attr('href') === '#') {
e.preventDefault();
}
});
@cmwelsh
cmwelsh / hover-slideout.js
Created October 12, 2011 16:09
JavaScript: Open and close a panel with scrollpane content
/* Schedule */
$(function () {
var $scheduleButton,
$schedulePanel,
$scheduleScrollpane,
initializeScrollpane;
var animationDuration = 400;
var scheduleOpen = false;
@cmwelsh
cmwelsh / gist:1281837
Created October 12, 2011 17:04
Twitter feed with scrolling
/* Twitter Feed */
jQuery(function ($) {
var $twitterList = $('.home-twitter > .inner');
if (!$twitterList.length) {
return;
}
// Twitter list has been filled with data
@cmwelsh
cmwelsh / admin_menu.php
Created October 14, 2011 20:32
Remove WordPress admin menu items
<?php
function remove_menus () {
global $menu;
// Any menu named below will be removed from the admin sidebar
$restricted = array(
__('Dashboard'),
__('Posts'),
__('Media'),
__('Links'),
__('Pages'),
@cmwelsh
cmwelsh / wordpress_siblings.php
Created October 17, 2011 16:20
WordPress Show Sibling Pages
<?php
global $post;
if ($post->post_parent) :
wp_list_pages(array(
'child_of' => $post->post_parent,
'title_li' => Null,
//'link_before' => '<span>',
//'link_after' => '</span>',
));
endif;