This file contains hidden or 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
<? | |
// See if we're trying to access the wp-admin area, prompt for 2nd layer of security | |
// Once this authenticates, you'll be able to login again at the main /wp-admin area. | |
// This is to prevent bots poking at the WordPress login area. You can do other things to help | |
// secure your WordPress site, this is just one of them. See http://codex.wordpress.org/Hardening_WordPress | |
// USAGE: Drop the code below in wp-config.php | |
if(stristr($_SERVER['PHP_SELF'], 'wp-login.php')) | |
{ | |
$user = 'someuser'; |
This file contains hidden or 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
/******************************** | |
* UPDATE: I have crated a plugin to do this: https://github.com/jboesch/jQuery-fullCalendar-iPad-drag-drop/ | |
*********************************/ | |
/*These are the brief steps that it takes to get fullCalendar (http://arshaw.com/fullcalendar/) up and running with drag/drop support on the iPad. This assumes you already have fullCalendar setup.*/ | |
//1. Include a copy of jQuery touch punch in your project, you can find it here: https://github.com/furf/jquery-ui-touch-punch | |
//2. Go into jquery-touch-punch.js and right after this line (around line 57 - mouseProto._mouseDown = function (event) {) add this: this._mouseDownEvent = event; | |
//3. Add this function somewhere in your global.js file or wherever you want: |
This file contains hidden or 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
// This will remove the text "Search:" | |
$('#thing').contents().each(function(){ | |
if(this.nodeType == 3){ | |
$(this).remove(); | |
} | |
}); | |
<div id="thing"> | |
Search: | |
<input type="text" /> |
This file contains hidden or 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
<? | |
// Looping over date ranges, requires PHP 5.3+ | |
$begin = new DateTime('2011-01-05'); | |
$end = new DateTime('2011-01-10'); | |
$interval = DateInterval::createFromDateString('1 day'); | |
$period = new DatePeriod($begin, $interval, $end); | |
$dates = array(); | |
foreach($period as $dt) |
This file contains hidden or 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
/** | |
* Get the date we just clicked on (td cell) | |
* | |
* @param {Object} $td The jQuery td element | |
*/ | |
var getDateFromTdCell = function($td) | |
{ | |
var self = this; |
This file contains hidden or 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
// Want to turn that string into a number.. BUT CANNOT FIND A jQUERY PLUGIN THAT'LL DO IT?! | |
// Boy are you in luck. | |
$.stringToNumber = function(num){ | |
return parseInt(num); | |
}; | |
// Usage $.stringToNumber('5') -> 5 |
This file contains hidden or 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
// Hide scrollbars on the calendar day instances (jQuery fullCalendar plugin: http://arshaw.com/fullcalendar/) | |
var $scrollbox = $('.cal-item .fc-view-agendaDay.fc-agenda > div > div') | |
// Hide the current scrollbars on a bunch of calendar divs (side-by-side) | |
.css('overflow-y', 'hidden') | |
// Since they're hidden and we're using another scrollbar to control | |
// them, we need to bind mousewheel to make sure that we can still | |
// mousewheel over the hidden boxes (jQuery mousewheel plugin) | |
.mousewheel(function(event, delta, deltaX, deltaY){ | |
// #scrolly is my new scrollbar to control them |
This file contains hidden or 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
// Current way of doing modules, you have to expose it via a return statement to make it public. | |
var Thing = (function(){ | |
function getStuff(){ alert('Stuff retrieved!'); | |
return { | |
getStuff: getStuff | |
} | |
})(); | |
// ECMAScript.Next proposal... adding "export" will make functions public. | |
// I wonder why they didn't just call it "public function".. export sounds like I'm downloading or something. Meh. |
This file contains hidden or 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
describe("AjaxForm", function() { | |
// Local vars for manipulation | |
var $form = null, | |
_requirejs_loaded = false, | |
found_errors = false, | |
submitted_successfully = false, | |
AjaxFormInstance = null, | |
RequireJSViews = { | |
AjaxFormView: null |
This file contains hidden or 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
boxSizing = rinputbutton.test( elem.nodeName ) && | |
( curCSS( elem, "-moz-box-sizing" ) === "border-box" || | |
curCSS( elem, "box-sizing" ) === "border-box" ) |