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 slow_compare($str1, $str2, $length = null) { | |
$out = ($str1_len = strlen($str1 .= chr(0))) - ($str2_len = strlen($str2 .= chr(0))); | |
if (!is_int($length)) $length = $str1_len; | |
for ($i = 0; $i < $length; $i++) | |
$out |= ord($str1[$i % $str1_len]) ^ ord($str2[$i % $str2_len]); | |
return 0 === $out; | |
} |
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 | |
/* | |
Originally by Marco Arment <me@marco.org>. | |
Edited by Martijn van der Ven <martijn@zegnat.net>. | |
This code is released in the public domain. | |
THERE IS ABSOLUTELY NO WARRANTY. | |
This class is aimed at PHP versions over 5.3 and below 5.5. |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
[Adblock Plus 1.3] | |
! Checksum: h6BrZGmz6mljqqZ43XaHrw | |
! [Gmail print cleaner] | |
! Gmail logo (left) and receipient email adress (right): | |
mail.google.com##body[onload="Print()"] .bodycontainer>table | |
! Horizontal line below logo/email adress: | |
mail.google.com##body[onload="Print()"] .bodycontainer>hr | |
! Title and message count: | |
mail.google.com##body[onload="Print()"] .maincontent>table:first-child |
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
document.querySelector('.crapcha input').value=Array.prototype.map.call(document.querySelectorAll('.crapcha .code span'),function(a){return a.textContent.length?a.textContent:String.fromCharCode(parseInt('F'+a.className.substr(5),16))}).join('') |
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 closestMidnight($date) { | |
if (!is_a($date, 'DateTime')) { | |
try { $date = new DateTime($date); } | |
catch (Exception $e) { | |
if (is_numeric($date)) { $date = (new DateTime())->setTimestamp(intval($date)); } | |
else { return false; } | |
} | |
} | |
$comp = clone $date; |
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 | |
// This assumes $text is the input we are parsing. | |
// I am using normal `echo`s here to output text, you will use whatever function you need. | |
if (preg_match('/^\/ba?ck(?:\s+(.*?))?\s*$/', $text, $result)) { | |
// $text matched! | |
if (isset($result[1]) && strlen($result[1]) > 0) { | |
// $text included an optional back message to display. | |
echo '<p><strong>Back:</strong> ' . $result[1] .'</p>'; | |
} else { |
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 //theme-specific template functions | |
/* ====================================================================================================================== */ | |
/* NoNonsense Forum v23 © Copyright (CC-BY) Kroc Camen 2012 | |
licenced under Creative Commons Attribution 3.0 <creativecommons.org/licenses/by/3.0/deed.en_GB> | |
you may do whatever you want to this code as long as you give credit to Kroc Camen, <camendesign.com> | |
*/ | |
//this function is called just before a templated page is outputted so that you have an opportunity to do any extra | |
//templating of your own. the `$template` object passed in is a DOMTemplate class, see '/lib/domtemplate/' for code | |
//or <camendesign.com/dom_templating> for documentation on how to template with it |
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 Fix ‘Blog A Penguin Classic’. | |
// @author Martijn van der Ven <martijn@zegnat.net> | |
// @id fix-blog-a-penguin-classic | |
// @namespace http://zegnat.net | |
// @version 0.5 | |
// @match http://*.blogapenguinclassic.co.uk/* | |
// ==/UserScript== | |
(function(a,i,b){ |
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
/* Put this in theme.php, inside the `theme_custom` function. */ | |
foreach ($template->query('.nnf_reply-author, #nnf_post-author') as $node) { | |
$name = strtolower(trim($node->nodeValue)); | |
$imgsrc = md5(''); | |
if (function_exists('filter_var')) { | |
if (filter_var($name, FILTER_VALIDATE_EMAIL)) { | |
$imgsrc = md5($name); | |
} | |
} else { $imgsrc = md5($name); } |