SRL Archive - Research & Development Lounge

GetGithubPage - Works on any PC.


Olly

2014-11-03 14:21:39

Came across a site http://rawgit.com/ that https isn't required therefore people without OpenSSL can read it. This means you auto update your script from Github, and it should work for everyone. :)

Just copy the URL from your browser while browsing the file you want to read, and use that as the URL parameter.

Example:
Writeln(GetGithubPage('https://github.com/SRL/SRL-6/blob/master/lib/utilities/drawing.simba'));

And the function (ps & Lape):

function GetGithubPage(const URL: String): String;
var
NewURL: String;
p: Integer;
begin
Result := '';
p := Pos('.com/', URL);
if (p = 0) then
Exit;

NewURL := Copy(URL, p + Length('.com/'), Length(URL) - p + Length('.com/'));
Result := GetPage('http://cdn.rawgit.com/' + Replace(NewURL, 'blob/', '', [rfReplaceAll]));
end;

The Mayor

2014-11-03 14:32:10

Very nice!!!! I hate using google code just to update scripts :D

Ashaman88

2014-11-03 14:47:28

From: The Mayor
Very nice!!!! I hate using google code just to update scripts :D


ditto! Thanks Olly

Kyle

2014-11-03 15:15:28

Your the best @Olly;!!!

Flight

2014-11-03 17:18:47

This is very handy; thank you. :smile:

N1234

2014-11-17 15:29:25

nice work, sure to make everybodies live a little easier eh?

Kyle

2014-11-20 08:05:22

Found a problem with it @Olly;. It doesn't update when your github page updates. I changed a page of reflection last night ~ 8 hours ago, and according to rawgit, the page is still the same. So i'm assuming it refreshes the page at set intervals…

Harrier

2014-11-20 08:15:28

From: elfyyy
Found a problem with it @Olly;. It doesn't update when your github page updates. I changed a page of reflection last night ~ 8 hours ago, and according to rawgit, the page is still the same. So i'm assuming it refreshes the page at set intervals…


Their cdn service perm caches the page… It will never update :/

Kyle

2014-11-20 08:16:19

From: Harrier
Their cdn service perm caches the page… It will never update :/


Oh well then that is kinda a problem haha

Just saw this as well

"It's best to use a specific tag or commit hash in the URL (not a branch). Files are cached permanently after the first request."

Harrier

2014-11-20 08:18:23

From: elfyyy
Oh well then that is kinda a problem haha


Guessing Olly forgot to read the FAQ :/

Frement

2014-11-20 08:20:44

An easy fix would be to use this for example:
http://static.frement.net/proxy.php?u=https://raw.githubusercontent.com/SRL/SRL-6/master/lib/utilities/drawing.simba

Olly

2014-11-20 10:25:15

Heh, Why would I read the faq!

Guess this idea is pointless. :p

Ian

2014-11-20 12:54:50

From: Frement
An easy fix would be to use this for example:
http://static.frement.net/proxy.php?u=https://raw.githubusercontent.com/SRL/SRL-6/master/lib/utilities/drawing.simba


Thanks, I'll update my scripts to do this :)