Page MenuHomeDevCentral

No OneTemporary

diff --git a/gadgets/_documents.xml b/gadgets/_documents.xml
index 7b52d27..9d55702 100644
--- a/gadgets/_documents.xml
+++ b/gadgets/_documents.xml
@@ -1,17 +1,17 @@
<documents topic="gadgets">
<document>
<article>motd-variations</article>
<title>English text variants MOTD</title>
<description>Calls `fortune` and prints it as is, in Jive and Valspeak.</description>
<head><![CDATA[
<style type="text/css">
/* A nice font for our text */
#content { font-family: "OFL Sorts Mill Goudy TT"; }
#content p { white-space: pre; margin: 0 0 4em 2em; font-size: 1.125em; }
</style>
- <link href='http://fonts.googleapis.com/css?family=OFL+Sorts+Mill+Goudy+TT:regular,italic' rel='stylesheet' type='text/css'>
+ <link href='//fonts.googleapis.com/css?family=OFL+Sorts+Mill+Goudy+TT:regular,italic' rel='stylesheet' type='text/css'>
]]>
</head>
</document>
-</documents>
\ No newline at end of file
+</documents>
diff --git a/microblogging/twitterpoints.php b/microblogging/twitterpoints.php
index 1a44f37..3396f78 100644
--- a/microblogging/twitterpoints.php
+++ b/microblogging/twitterpoints.php
@@ -1,81 +1,81 @@
<form>
<div class="row collapse">
<div class="ten mobile-three columns">
<input type="text" name="username" id="username" value="" placeholder="Enters the Twitter username." />
</div>
<div class="two mobile-one columns">
<input type="submit" class="button expand postfix" value="Count" />
</div>
</div>
</form>
<?php
if (isset($_REQUEST['username']) && $_REQUEST['username'] != '') {
$username = $_REQUEST['username'];
$errorMessage = '';
if (!preg_match('/^[A-Za-z0-9_]{1,15}$/', $username)) {
$errorMessage = "$username doesn't seem to be a valid Twitter username.";
} else {
require_once('TwitterAPIExchange.php');
$url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?screen_name=' . urlencode($_REQUEST['username']) . '&include_rts=false&count=200';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($Config['TwitterAPI']);
$response = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$response = json_decode($response);
if (isset($response->errors)) {
foreach ($response->errors as $error) {
$errorMessage .= "<p>$error->message</p>";
}
} elseif (isset($response->error)) {
$errorMessage = "<p>$response->error</p>";
}
}
if ($errorMessage !== '') {
echo "<h2>Can't compute stats.</h2>$errorMessage";
} else {
$stats = [
'tweets' => 0,
'total_length' => 0,
'len_140' => 0
];
foreach ($response as $tweet) {
$len = strlen($tweet->text);
$stats['tweets']++;
$stats['total_length'] += $len;
if ($len == 140) { $stats['len_140']++; }
}
$name = $tweet->user->name;
- $avatar = $tweet->user->profile_image_url;
+ $avatar = $tweet->user->profile_image_url_https;
echo '<div style="text-align: center;">';
echo "<h2>$name</h2>";
echo '<img src="', $avatar, '" alt="', $name, "'s", ' avatar" />';
$score = $stats[len_140] . " Twitter Point" . s($stats['len_140']);
echo "<h3>$score</h3>";
$s = s($stats['tweets']);
echo "<h4>Computed from the last $stats[tweets] tweet$s</h4>";
$avg = $stats['total_length'] / $stats['tweets'];
$avg_rnd = round($avg);
$avg = round($avg, 5);
$s = s($avg);
echo "<h4 class=\"hide-for-touch\">Average tweet length: <abbr title=\"$avg\">$avg_rnd</abbr> character$s</h4><h4 class=\"show-for-touch\">Average tweet length: $avg character$s</h4>";
//RT
- $url = 'http://twitter.com/intent/tweet?url=http://tools.dereckson.be/TP/' . $username . '&text=%23TP ' . $score . '%20%E2%80%94&related=dereckson,weneldur';
+ $url = 'https://twitter.com/intent/tweet?url=http://tools.dereckson.be/TP/' . $username . '&text=%23TP ' . $score . '%20%E2%80%94&related=dereckson,weneldur';
echo '<p>[ <a href="', $url, '" target="_blank"><i class="social foundicon-twitter"> Share score</i></a> ]</p>';
//Info
echo '<p style="margin-top: 3em;">You got a Twitter Point each time your tweet is exactly 140 characters.<br />Rules: Yours, not the RT. Points expire after a little less than 200 messages.<br />The Twitter Point concept <a href="https://twitter.com/Weneldur/status/380416650899488768">has been created</a> by Ælfgar.</p>';
echo '</div>';
echo '<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>';
}}
?>
diff --git a/themes/RalfFallsIntoFoundation/header.php b/themes/RalfFallsIntoFoundation/header.php
index 1daf6e0..3e32684 100755
--- a/themes/RalfFallsIntoFoundation/header.php
+++ b/themes/RalfFallsIntoFoundation/header.php
@@ -1,63 +1,63 @@
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<!-- Set the viewport width to device width for mobile -->
<meta name="viewport" content="width=device-width" />
<title><?= $document->title ?> - Tools</title>
<!-- Included CSS Files (Uncompressed) -->
<!--
<link rel="stylesheet" href="/stylesheets/foundation.css">
-->
<!-- Included CSS Files (Compressed) -->
<link rel="stylesheet" href="/stylesheets/foundation.min.css">
<script src="/javascripts/modernizr.foundation.js"></script>
- <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,400italic' rel='stylesheet' type='text/css'>
+ <link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,400italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/stylesheets/general_foundicons.css">
<link rel="stylesheet" href="/stylesheets/general_enclosed_foundicons.css">
<link rel="stylesheet" href="/stylesheets/social_foundicons.css">
<link rel="stylesheet" href="/stylesheets/accessibility_foundicons.css">
<!--[if lt IE 8]>
<link href="/stylesheets/general_foundicons_ie7.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/general_enclosed_foundicons_ie7.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/social_foundicons_ie7.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/accessibility_foundicons_ie7.css" media="screen" rel="stylesheet" type="text/css" />
<![endif]-->
<link rel="stylesheet" href="/stylesheets/caslon_ampersand.css">
<link rel="stylesheet" href="/stylesheets/app.css">
<?= $document->head ?>
</head>
<body>
<!-- Header -->
<header>
<div class="row">
<div class="twelve columns">
<h1><a href="/"><i class="general foundicon-tools"></i></a><?= $document->title ?></h1>
</div>
</div>
<div class="row">
<div class="six columns">
<?php
if ($document->description) {
$description = str_replace('&', '<span class="ampersand">&amp;</span>', $document->description);
echo '<p><i class="accessibility foundicon-question"></i><br />', $description, '</p>';
}
?>
</div>
<div class="six columns">
<p class="right"><a href="/"><i class="accessibility foundicon-braille"></i></a><br />
Tools — <em>Small utilities, gadgets <span class="ampersand">&amp;</span> scripts to perform daily tasks.</em></p>
</div>
</div>
</header>
<!-- Body -->
<section id="content"<?php if (isset($_COOKIE["UITonality"]) && $_COOKIE["UITonality"] != "light") { echo " class=\"$_COOKIE[UITonality]\""; } ?>><div class="row">
diff --git a/wikimedia/dev/feeds/user/genindex b/wikimedia/dev/feeds/user/genindex
index 7ac3b3b..7fc66ba 100755
--- a/wikimedia/dev/feeds/user/genindex
+++ b/wikimedia/dev/feeds/user/genindex
@@ -1,106 +1,106 @@
#!/usr/bin/env tclsh
#
# Generate feeds index
#
#Gets MD5 hash
proc md5 {string} {
#tcllib way:
#package require md5
#string tolower [::md5::md5 --hex $string]
#BSD way:
#exec -- md5 -q -s $string
#Linux way:
#exec -- echo -n $string | md5sum | sed "s/\ *-/\ \ /"
#Solaris way:
#lindex [exec -- echo -n $string | md5sum] 0
#OpenSSL way:
exec -- echo -n $string | openssl md5
}
namespace eval ::gravatar {
#Gets Gravatar e-mail hash
#http://en.gravatar.com/site/implement/hash/
proc get_hash {mail} {
md5 [string tolower [string trim $mail]]
}
#Gets Gravatar URL
#http://en.gravatar.com/site/implement/images/
#size: 1-512 (in pixels, default 80px
#default: what to print if hash not found, default gravatar logo
# values: 404 mm identicon monsterid wavatar retro or an URL
#rating: g pg r x
#We don't validate parameters, are API is unstable and evolves often.
proc get_url {mail {size 0} {default ""} {rating ""}} {
- set url http://www.gravatar.com/avatar/
+ set url //www.gravatar.com/avatar/
append url [get_hash $mail]
set params {}
if {$size != 0} {
lappend params s $size
}
if {$default != ""} {
lappend params d $default
}
if {$rating != ""} {
lappend params r $rating
}
if {[llength $params] > 0} {
append url ?[::http::formatQuery {*}$params]
}
return $url
}
}
proc get_feed_info {feed} {
}
proc generate_index {{dir .} {index index.xml}} {
set fd [open index.tmp r]
set data [read $fd]
close $fd
set fd [open $index w]
puts $fd "<feeds>"
foreach file $data {
if {$data == ""} {continue}
# Gets feed name and e-mail
set name ""
set email ""
set fdfeed [open $file r]
set data [read $fdfeed 4096]
close $fdfeed
if [catch {
set pos [string first "owner email=" $data]
if {$pos == -1} {
set pos [string first "<user email=" $data]
}
set pos2 [string first "\"" $data $pos+13]
set email [string range $data $pos+13 $pos2-1]
set pos [string first ">" $data $pos2]
set pos2 [string first "<" $data $pos]
set name [string range $data $pos+1 $pos2-1]
}] {
puts stderr "Not a valid feed file: $file"
continue
}
# Writes feed entry (title, avatar from Gravatar and file)
puts $fd "\t<feed>"
puts $fd "\t\t<title>$name</title>"
puts $fd "\t\t<avatar>[gravatar::get_url $email]</avatar>"
puts $fd "\t\t<file>$file</file>"
puts $fd "\t</feed>"
}
puts $fd "</feeds>"
close $fd
}
-generate_index
\ No newline at end of file
+generate_index

File Metadata

Mime Type
text/x-diff
Expires
Sun, Oct 12, 09:24 (5 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3065657
Default Alt Text
(10 KB)

Event Timeline