View readable.py
import hashlib | |
import time | |
import requests | |
class ReadableAPIClient: | |
""" | |
API Client for Readable.io, written for Python 3 | |
See API documentation: https://readable.io/api/docs/ |
View ReadableApi.vb
'===================================================================== | |
' Readable.io REST Post Test | |
' -------------------------- | |
' Basic asp.net (VB.Net) 4 page with textbox, label and submit button | |
' Created: 25 May 2018 | |
' Author: humanotics.co.uk | |
'===================================================================== | |
Imports System.Net | |
Imports System.Security.Cryptography |
View ean_check.php
<?php | |
/* | |
0346745008178 | |
Should fail - checksum should be 9 | |
5060096384137 | |
Should pass | |
5020650002112 |
View Querystrings.php
<?php | |
/* | |
Add and remove querystring variables from URLs. | |
*/ | |
function addQuerystringVar($url, $key, $value) { | |
$url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&'); | |
$url = substr($url, 0, -1); | |
if (strpos($url, '?') === false) { | |
return ($url . '?' . $key . '=' . $value); | |
} else { |
View SoftHyphens.php
<?php | |
/* | |
This function will add soft hyphens after every 3rd character in words of over 10 characters. | |
*/ | |
public static function SoftHyphens($text) { | |
$return = ''; | |
// Add spaces around HTML tag delimiters, to process them as individual words (to be removed later) | |
$text = str_replace('>', '> ', $text); | |
$text = str_replace('<', ' <', $text); |
View gist:154029
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD) [NC] # Only rewrite GET requests | |
RewriteCond %{HTTP_HOST} olddomain\.com [NC] | |
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301] | |
RewriteCond %{HTTP_HOST} olddomain\.com [NC] # Otherwise block | |
RewriteRule ^(.*)$ - [F] |
View gist:154025
<?php | |
function generate_url_from_text($strText) { | |
$strText = preg_replace('/[^A-Za-z0-9-]/', ' ', $strText); | |
$strText = preg_replace('/ +/', ' ', $strText); | |
$strText = trim($strText); | |
$strText = str_replace(' ', '-', $strText); | |
$strText = preg_replace('/-+/', '-', $strText); | |
$strText = strtolower($strText); | |
return $strText; |
View gist:154015
<?php | |
function trim_text_in_sentences($intLength, $strText) { | |
$intLastPeriodPos = strpos(strrev(substr($strText, 0, $intLength)), '.'); | |
if ($intLastPeriodPos === false) { | |
$strReturn = substr($strText, 0, $intLength); | |
} else { | |
$strReturn = substr($strText, 0, ($intLength - $intLastPeriodPos)); | |
} | |
return $strReturn; |
View View Page Source.js
function viewSource() { | |
var httpRequest; | |
try { | |
httpRequest = new XMLHttpRequest(); | |
}catch(trymicrosoft) { | |
try { | |
httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); | |
} catch(oldermicrosoft) { | |
try { | |
httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); |