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 | |
set_time_limit(120); | |
$domains = ClassRegistry::init('Domain')->find('all', array( | |
'conditions' => array( | |
'url' => $_GET['domain'] | |
//'paid_recurring' => 1 | |
), | |
'recursive' => -1 | |
)); |
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
<? | |
// routes.php | |
Router::connect('/animals/:action/*', array( | |
'plugin' => 'big', | |
'controller' => 'BigAnimalsController' | |
)); | |
/* | |
* Now I navigate to /animals and I look at my action attribute on my <form> tag | |
* How come my $form->create(array('controller' => 'animals')); call still outputs: |
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
/**************************************************************** | |
* AppController.php | |
*****************************************************************/ | |
<? | |
/** | |
* Most application-wide logic should be handled here | |
* | |
*/ | |
class AppController extends Controller | |
{ |
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
<? | |
// i login successfully with if($this->Auth->login()) but as soon as I call $this->redirect($this->Auth->redirect()); | |
// it boots me back to the login screen. | |
public function beforeFilter() | |
{ | |
//Deny access to everything by default, let isAuthorized decide to let them in | |
$this->Auth->deny("*"); | |
// Set up auth error messages here, where they can actually be translated |
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
<? | |
// 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 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 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 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 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 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. |