Skip to content

Instantly share code, notes, and snippets.

View jawinn's full-sized avatar

Josh Winn jawinn

View GitHub Profile
@jawinn
jawinn / gist:5762804
Last active December 18, 2015 09:39 — forked from bitfade/gist:4555047
Remove empty paragraph tags and extraneous BRs from shortcodes. List shortcodes on line 8.
<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join("|",array("col","shortcode2","shortcode3"));
// opening tag
@jawinn
jawinn / gist:6241766
Created August 15, 2013 15:28
.htaccess - redirect pages that are not the home page
# AUTO 301 REDIRECT PAGES THAT ARE NOT THE HOME PAGE
RewriteCond %{REQUEST_URI} !^/index.php$ [OR]
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^(.*)$ http://www.YOURDOMAIN.com/$1 [R=301,L]
@jawinn
jawinn / gist:6241779
Last active December 21, 2015 03:19
jQuery - Required checkbox to submit form (simple w/ alert)
// checkbox must be checked to submit form
$('#contact-submit').click(function(e) {
var checked = $('#contact-side :checkbox:checked').length;
if (checked == 0) {
alert('Before this form can be sent, you must agree to the disclaimer.');
e.preventDefault();
} else {
$('#contact-side form').submit();
}
});
@jawinn
jawinn / gist:6600663
Last active December 23, 2015 07:28
Debugging Error - Renderer.java for Rajawali Live Wallpaper Template - Can't change color on OBJ. Can change color on created cube. The imported OBJ is in the raw folder and is named "testscene_obj".
package com.mydomain.wallpaper.mywallpaper;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import rajawali.Object3D;
import rajawali.parser.LoaderOBJ;
import rajawali.parser.ALoader.ParsingException;
import rajawali.animation.Animation3D.RepeatMode;
@jawinn
jawinn / Testing-OBJ-File.obj
Last active December 23, 2015 09:49
Test OBJ file exported from 3ds Max. Triangulated and YZ flipped. Box floor with some primitives on it (sphere, box, teapot, pyramid, cylinders).
# 3ds Max Wavefront OBJ Exporter v0.97b
# File Created: 07.09.2013 21:08:08
#
# object Box001
#
v -24.597288 0.000000 18.723301
v -24.597288 0.000000 -30.350199
v 28.258261 0.000000 -30.350199
@jawinn
jawinn / boostrap-youtube-modal.js
Last active July 20, 2017 03:40
BOOTSTRAP 3.0 - Open YouTube Video Dynamicaly in Modal Window. Allow setting width and height.
// REQUIRED: Include "jQuery Query Parser" plugin here or before this point:
// https://github.com/mattsnider/jquery-plugin-query-parser
$(document).ready(function(){
// BOOTSTRAP 3.0 - Open YouTube Video Dynamicaly in Modal Window
// Modal Window for dynamically opening videos
$('a[href^="http://www.youtube.com"]').on('click', function(e){
// Store the query string variables and values
// Uses "jQuery Query Parser" plugin, to allow for various URL formats (could have extra parameters)
@jawinn
jawinn / SublimeOnSaveBuild.sublime-settings
Last active February 22, 2018 09:08
Regex to ignore SASS / LESS partials (files starting with underscore) from being built by SublimeOnSaveBuild
// UPDATED VERSION
{
"filename_filter": "(/|\\\\|^)(?!_)(\\w+)\\.(css|js|sass|less|scss)$",
"build_on_save": 1
}
// DEFAULT (for reference, in case you need it back)
{
"filename_filter": "\\.(css|js|sass|less|scss)$",
"build_on_save": 1
@jawinn
jawinn / Unity Method Commenting.cs
Created October 8, 2013 01:01
Unity - How to Comment your Functions & Parameters (with XML Comments)
/// <summary>
/// You would not believe what amazing things this method does.
/// </summary>
/// <param name="exampleInteger">A explanation of this really important number </param>
public static void DoSomething(int exampleInteger){}
@jawinn
jawinn / web.config
Created October 31, 2013 02:30
Fix X-UA-Compatible With IIS
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=Edge,chrome=1" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
@jawinn
jawinn / maxlistitems-example.js
Created December 13, 2013 22:06
Hide Max List Items Usage
$(document).ready(function() {
$('#content ul').hideMaxListItems({
'max':6,
'speed':2000,
'moreText':'READ MORE',
'lessText':'READ LESS',
'moreHTML': '<p class="maxlist-more"><a href="#">MORE OF THEM</a></p>'
});
});