Skip to content

Commit

Permalink
Fixed #193
Browse files Browse the repository at this point in the history
  • Loading branch information
LeaVerou committed Apr 18, 2013
1 parent f6e3521 commit 7416ab3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions code/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,12 @@ var _ = window.Editor = function(pre) {
var newse = pre.selectionEnd,
innerHTML = pre.innerHTML;

innerHTML = pre.innerHTML
/*innerHTML = pre.innerHTML
.replace(/(<\w+)(\s.+?>)/g, '$1>')
.replace(/<\/?pre>/g, '')
.replace(/(<div>)?<br>|(<div>)+/gi, '\n')
.replace(/<\/div>/gi, '')
.replace(/&nbsp;/gi, ' ');
.replace(/&nbsp;/gi, ' ');*/

pre.innerHTML = innerHTML;

Expand Down
6 changes: 6 additions & 0 deletions keys.template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

$client_id = 'YOUR GITHUB CLIENT ID HERE';
$client_secret = 'YOUR GITHUB SECRET KEY HERE';

?>
6 changes: 2 additions & 4 deletions sample.oauth.php → oauth.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php

// This file should be the one's URL you give to Github as a callback
require 'keys.php';

$code = $_REQUEST['code'];

$client_id = 'da931d37076424f332ef';
$client_secret = 'YOUR_SECRET_HERE';

if($code) {
$ch = curl_init('https://github.com/login/oauth/access_token');

Expand All @@ -28,6 +25,7 @@
}
}
?>

<script>
opener.gist.oauth[1]('<?= $token ?>');
close();
Expand Down
4 changes: 4 additions & 0 deletions result/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# error_reporting(E_ALL);
# ini_set('display_errors', 1);

require '../keys.php';

preg_match('#\bgist\/([\da-f]+)#i', $_SERVER['REQUEST_URI'], $gist_id);
$gist_id = $gist_id[1];

Expand All @@ -17,6 +19,8 @@
$uri .= "/$gist_rev";
}

$uri .= "?client_id=$client_id&client_secret=$client_secret";

try {
$raw = file_get_contents($uri);
} catch(Exception $e) {
Expand Down

0 comments on commit 7416ab3

Please sign in to comment.