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
/* | |
* DJBX33A (Daniel J. Bernstein, Times 33 with Addition) | |
* | |
* This is Daniel J. Bernstein's popular `times 33' hash function as | |
* posted by him years ago on comp.lang.c. It basically uses a function | |
* like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best | |
* known hash functions for strings. Because it is both computed very | |
* fast and distributes very well. | |
* | |
* The magic of number 33, i.e. why it works better than many other |
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
for( i = 0; i < MAX_STRING_LEN; i++ ) { | |
bk = 0; | |
in[0] = 0; | |
for( n = i; n >= 0; n-- ) { | |
in[n] = 1; | |
} | |
len = strlen(in); | |
for( j = len; j >= 0; j-- ) { | |
for( n = 1; n < 255; n++ ) { | |
in[j] = n; |
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
define('ITERATIONS', 1000000); | |
define('ROUNDS', 10); | |
function original($singular, $args = null) { | |
if ($args === null) { | |
return true; | |
} else { | |
return false; | |
} | |
} |
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
config.vm.provider "virtualbox" do |v| | |
v.memory = 2048 | |
v.cpus = 2 | |
end |
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 | |
$string ="1b5b33366d436f6465736e69666665722e436c65616e7570207368656c6c1b5b306d20666f722043616b655048500a0a322066696c657320666f756e642e20436865636b696e67202e2e2e0a2f686f6d652f7472617669732f6275696c642f6465726575726f6d61726b2f63616b657068702d636f6465736e69666665722f74657374732f746573745f6170702f556e757365645573652f556e75736564557365457874656e6465642e7068703a0a202d20436f6f6c466f6f0a202d20536f6d654f74686572436c6173730a202d204974657261746f724974657261746f72466f6f0a202d204461746574696d650a202d204361736553656e736974697665436c6173730a3520756e75736564207573652073746174656d656e7428732920666f756e642e0a2f686f6d652f7472617669732f6275696c642f6465726575726f6d61726b2f63616b657068702d636f6465736e69666665722f74657374732f746573745f6170702f556e757365645573652f556e757365645573652e7068703a0a202d20536f6d654f74686572436c6173730a3120756e75736564207573652073746174656d656e7428732920666f756e642e0a46696e6973686564210a4120746f74616c206f66203620756e75736564207573652073746174656d656e7428732920666f756e642e0a"; | |
while(strlen($string) > 0 |
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 | |
echo $this->Form->create('Event'); | |
echo $this->Form->input('Event.reservation_id', array('empty' => __('Create a reservation for this event'), 'required' => false)); | |
echo $this->Form->end(); | |
$this->Js->buffer('urls.reservationsGet = "' . $this->Html->url(array('controller' => 'reservations', 'action' => 'get')) . '/";'); | |
?> | |
<script type="text/javascript"> | |
$('#EventReservationId').on('change', 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
# add this to redirect non-www to www urls | |
RewriteCond ${HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,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
class AppModel extends Model { | |
public function __construct($id = false, $table = null, $ds = null) { | |
if($ds) { | |
$ds->cacheMethods = false; | |
$ds->cacheSources = false; | |
} | |
parent::__construct($id, $table, $ds); | |
$this->setDataSource($this->useDbConfig); | |
$db =& ConnectionManager::getDataSource($this->useDbConfig); | |
$db->cacheMethods = false; |
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 | |
App::uses('AppModel', 'Model'); | |
/** | |
* Test Model | |
* | |
*/ | |
class Test extends AppModel { | |
} |
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
class Appcontroler extends Controller { | |
public function referer($default = null, $local = false) | |
{ | |
$referer = $this->request->session()->read('Session.referer'); | |
if($default === null && $referer) { | |
return $referer; | |
} | |
return parent::referer($default, $local); | |
} |
OlderNewer