This is document has moved. It now lives at https://klr.nu/api/v2/docs
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 correctYYMMDD($input){ | |
$input = substr($input, 0, 6); | |
//is it already in correct format? | |
if(preg_match('/[0-9][0-9](1[0-2]|0[1-9])([0-2][0-9]|3[01])/', $input)) return $input; | |
//let's reverse it. | |
$rev = array(); | |
$rev['yy'] = substr($input, 4, 2); |
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 | |
protected static function validatePNumber($pnumber) { | |
/* Check valid form (existing month and day) */ | |
if (!preg_match("/^[0-9]{2}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))[0-9]{4}$/", $pnumber)) return false; | |
/* Calculate check sum and check wether or not the control digit is correct */ | |
$sum = 0; | |
$x = 0; | |
for ($i = 0; $i < 10; $i++) { |
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
(function a() { | |
var a, b; | |
Array.prototype.forEach.call(document.querySelectorAll("pre"), function (a) { | |
a.className = "prettyprint linenums" | |
}), a = document.createElement("script"), a.onload = function () { | |
prettyPrint() | |
}, a.src = "https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sunburst", document.body.appendChild(a) | |
})(); |
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
(function(){ | |
document.body.appendChild(document.createElement('script')).src='http://premailer.dialect.ca/inc/bookmarklet-1.0.js'; | |
})(); |
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 | |
print '<meta charset="utf8" /><pre>'; | |
require_once('oauth.php'); | |
$settings = array( | |
'oauth_access_token' => "", | |
'oauth_access_token_secret' => "", | |
'consumer_key' => "", | |
'consumer_secret' => "" | |
); |
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 mymodule_form($form, &$form_state) { | |
// [...] | |
$form['attachment'] = array( | |
'#type' => 'file', | |
'#title' => t('Attachment'), | |
); | |
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
#!/bin/bash | |
# Change the server address. Run in the /logs/ directory. | |
apihost="http://api.localhost"; | |
logfile=$(ls -tr xmpp_* | tail -1); | |
# Dont edit below this line :) | |
vcard=""; | |
# Using awk to flush every line separately to avoid buffering issues. I think. | |
tail -f "$logfile" | awk '{print $0; fflush()}' | while read -r line |