This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Force HTTPS | |
Version: 0.1 | |
Description: Quick and dirty way to ensure content is served over SSL if no mixed content. Removes the "http:" and "https:" from external images embedded in the_content so that SSL can be enabled without the security warning in IE. Redirects to HTTPS if no mixed-content warning will be generated; redirects back to HTTP if it will. Makes use of output buffering. Developed at <a href="http://shepherdinteractive.com/">Shepherd Interactive</a>. | |
Author: Weston Ruter | |
Author URI: http://weston.ruter.net/ | |
*/ | |
function wr_force_https_init(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if($_SERVER['REQUEST_METHOD'] == 'POST'): | |
header("Location: http://$_SERVER[HTTP_HOST]/create.php?created", true, 201); | |
?> | |
Created <a href='create.php?created'>resource</a> | |
<?php | |
exit; | |
elseif($_SERVER['QUERY_STRING'] == 'created'): ?> | |
<h1>I am the created resource!</h1> | |
<?php endif; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Not only bind a handler to an event, but also call it immediately once. | |
* @param {string} event One or more event types separated by spaces. Only first listed will be immediately called. | |
* @param {function(Object)} callback The event handler | |
* @returns {jQuery} | |
*/ | |
jQuery.fn.bindAndCall = function(type, callback){ | |
this.bind(type, callback); | |
var types = type.split(/\s+/); //because only one type makes sense to call | |
this.each(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* bindAndTrigger - v0.2 - 04/30/2010 | |
* http://benalman.com/ (original v0.1 at http://gist.github.com/384866 ) | |
* http://weston.ruter.net/ (playing around with improving variable args) | |
* | |
* http://jsfiddle.net/cowboy/fJnA2/ | |
*/ | |
(function($,undefined){ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Same as jQuery('…').attr(name, value) but for DOM attributes (properties) | |
* @param {string} name The property name | |
* @param {mixed} value The property value | |
* @todo Allow for passing setter | |
*/ | |
jQuery.fn.prop = function(name, value){ | |
if(typeof value == 'undefined'){ | |
return this.length ? this[0][name] : null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class WidgetWithBehaviorScript extends WP_Widget { | |
function __construct() { | |
parent::__construct(__CLASS__, 'Widget with Accompanying Behavior Script', array( | |
'classname' => __CLASS__, | |
'description' => "This WordPress widget serves as a pattern for how to enqueue a script only if the widget is actually rendered." | |
)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
// jQuery hide() and show() supporting HTML5 hidden attribute | |
// "All HTML elements may have the hidden content attribute set. The hidden | |
// attribute is a boolean attribute. When specified on an element, it indicates | |
// that the element is not yet, or is no longer, relevant. User agents should | |
// not render elements that have the hidden attribute specified." | |
// http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#the-hidden-attribute | |
// Pointers from http://www.bennadel.com/blog/1624-Ask-Ben-Overriding-Core-jQuery-Methods.htm | |
var originalHide = jQuery.fn.hide; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Webpage Exposé | |
// @description Hit Alt+Spacebar to toggle zooming in & out of a page so that everything can be seen at once. When zoomed out, clicking on an element will unzoom and scroll to it. Uses CSS3 Transforms. Tested in Chrome and Firefox 4 w/ Greasemonkey. | |
// @namespace http://weston.ruter.net/ | |
// @include * | |
// @license GPL/MIT | |
// @version 0.2 | |
// @author Weston Ruter (@westonruter) <http://weston.ruter.net/> of X-Team <http://x-team.com/> | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf8 # | |
from django.db import models | |
from django.db.models import Q | |
from django.utils.translation import ugettext_lazy as _ | |
from core.models import Language, License, Server | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Wikipedia TTS-friendly Markup | |
// @description Include a button in the toolbar on Wikipedia articles to toggle the inclusion of elements not suitable for feeding into a screen-reader. | |
// @namespace http://weston.ruter.net/ | |
// @include http://en.wikipedia.org/wiki/* | |
// ==/UserScript== | |
var noReadEls = []; | |
Array.forEach(document.querySelectorAll('#bodyContent sup, #toc, .editsection'), function(el){ |