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 | |
// We want to make certain we have the repose context | |
// included so that we can get the reposeSessionFactory | |
// object. | |
$context->import('repose.context.php'); | |
$context->set('spaceRepository', array( | |
'className' => 's3a_domain_ReposeSpaceRepository', | |
'constructorArgs' => array( |
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 | |
// Called when the POST form is submitted. | |
protected function onSubmit(halo_HttpRequest $httpRequest, halo_HttpResponse $httpResponse) { | |
$space = $this->spaceRepository->findById( | |
$httpRequest->getUrlParam('spaceId') | |
); | |
$space->setName($httpRequest->getPostParam('name')); | |
$space->setPhone($httpRequest->getPostParam('phone')); | |
$space->setAddressLine1($httpRequest->getPostParam('addressLine1')); | |
$space->setAddressLine2($httpRequest->getPostParam('addressLine2')); |
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 | |
// Import the Space Repository. | |
$context->import('s3a_spaceRepository.context.php'); | |
// Define the Space Edit controller, and make certain that the Space Repository | |
// is set. | |
$context->set('spaceEditController', array( | |
'className' => 's3a_controllers_admin_SpaceEditController', | |
'properties' => array( | |
'spaceRepository' => $context->ref('spaceRepository'), |
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 | |
curl_setopt_custom_postfields($ch, array( | |
'file' => '@/path/to/file', | |
'tag' => array('a', 'b', 'c'), | |
)); | |
?> |
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 | |
function curl_setopt_custom_postfields($ch, $postfields, $headers = null) { | |
$algos = hash_algos(); | |
$hashAlgo = null; | |
foreach ( array('sha1', 'md5') as $preferred ) { | |
if ( in_array($preferred, $algos) ) { | |
$hashAlgo = $preferred; | |
break; | |
} | |
} |
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
<fb:narrow> | |
<div class="header">Header</div> | |
<div class="image"> | |
<fb:random> | |
<fb:random-option> | |
<img src="sample1.jpg" /> | |
</fb:random-option> | |
<fb:random-option> | |
<img src="sample2.jpg" /> | |
</fb:random-option> |
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
import pycurl | |
import sys | |
class Storage: | |
def __init__(self): | |
self.contents = '' | |
self.line = 0 | |
def store(self, buf): | |
self.line = self.line + 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
jQuery('.emailLink').click(function(e) { | |
e.preventDefault(); | |
var $link = jQuery(this); | |
var $sending = jQuery('<span>Sending...</span>'); | |
$link.after($sending); | |
$link.hide(); | |
var restoreCb = function() { | |
$link.show(); | |
$sending.remove(); | |
}; |
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
# Works as expected for .htaccess | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule / http://example.com/ [L] | |
# Works as expected for main configuration | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f | |
RewriteRule / http://example.com/ [L] |
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 SomeModel extends Model { | |
function doSomething ($foo) { | |
// need to work with another model... | |
$CI =& get_instance(); | |
$CI->load->model('SomeOtherModel','NiceName',true); | |
// use $CI instead of $this to query the other models. Shorter anyway ;-) | |
$CI->NiceName->doSomethingElse(); | |
} | |
?> |