Skip to content

Instantly share code, notes, and snippets.

@solepixel
solepixel / fade-label.jquery.js
Created September 18, 2014 19:33
Fade Labels for jQuery
/**
* Fade Labels
*
* @version 1.0.0
* @author Brian DiChiara
* @website http://briandichiara.com
*/
(function ( $ ) {
$.fn.fadeLabel = function( options ){
@solepixel
solepixel / acf-reusable_field_group-v5.php
Created October 28, 2014 14:17
render_field() method in ACF-Reusable-Field-Group extension for Advanced Custom Fields/Pro Plugin
<?php
// ...
// @ line 137
# see https://github.com/tybruffy/ACF-Reusable-Field-Group/blob/master/acf-reusable_field_group-v5.php#L137
function render_field( $field ) {
global $post;
$current_id = $post->ID; ### $post is not defined/availabe on a Settings page
@solepixel
solepixel / im-bruce-willis.lyrics.txt
Last active May 14, 2018 14:14
I'm Bruce Willis by Wreck&Salvage (https://vimeo.com/13033974)
Yeah
Yo, why you tryin' to hurt me girl
Don'tcha know I'm Bruce Willis.
Yeah
Yo, why you tryin' to hurt me girl
Don'tcha know I'm Bruce, Bruce
// Load plugins
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
cache = require('gulp-cache'),
compass = require('gulp-compass'),
concat = require('gulp-concat'),
imagemin = require('gulp-imagemin'),
jshint = require('gulp-jshint'),
imagemin = require('gulp-imagemin'),
livereload = require('gulp-livereload'),
@solepixel
solepixel / really-sticky-posts.php
Last active August 29, 2015 14:23
This little snippet will consistently place sticky posts at the top of ALL post archive pages, not just the first page.
<?php
add_filter( 'the_posts', 'mytheme_inject_sticky_posts', 10, 2 );
function mytheme_inject_sticky_posts( $posts, $q ){
// Don't do this in the admin or on page 1, WP already does it for page 1
if( is_admin() || $q->get( 'paged' ) <= 1 )
return $posts;
// get the sticky posts array
@solepixel
solepixel / .htaccess
Last active February 13, 2024 15:00
This htaccess snippet (lines 4-12) will pull any missing images from another URL. Helpful when developing locally or on a staging site where media is present on production but is too much to migrate to staging or locally.
<IfModule mod_rewrite.c>
RewriteEngine On
# BEGIN Use uploads directory from Live Site
RewriteBase /wp-content/uploads/
RewriteCond %{HTTP_HOST} !^www\.livedomain\.com
RewriteCond %{HTTP_HOST} !^livedomain\.com
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
@solepixel
solepixel / .htaccess
Created August 29, 2015 12:54
Hash signs in URI
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} /([^?\ ]+)
RewriteRule (.*) index.php/%1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
@solepixel
solepixel / uri-segments.php
Created August 29, 2015 12:59
Function to parse URI segments.
<?php
function uri($segment=NULL, $qs=false){
$uri = $_SERVER['REQUEST_URI'];
if(!$qs || $segment !== NULL){
if(strpos($uri, '?')){
list($uri, $query) = explode('?', $uri);
}
if($segment !== NULL){
if(is_string($segment)){
if($segment != 'last'){
@solepixel
solepixel / Session.php
Created August 29, 2015 13:06
CodeIgniter function with @ symbol
<?php
// Lines 706-721 of system/libraries/Session.php
function _unserialize($data)
{
$data = @unserialize(strip_slashes($data));
if (is_array($data))
{
foreach ($data as $key => $val)
{
@solepixel
solepixel / remap.php
Created August 29, 2015 13:07
CodeIgniter _remap function.
<?php
function _remap($method)
{
if (method_exists($this, $method)){
$this->$method($this->uri->segment(3));
} else {
$this->index($method);
}
}