├── latesttweetid.txt ├── lib ├── latesttweetid.txt ├── Translations.php ├── README.md ├── translations │ └── apodr.php ├── TwitterSearch.php ├── Twitteroauth.php ├── TweetMunger.php └── OAuth.php ├── .gitignore ├── readme.md ├── index.sample.php └── pages ├── 2012-01-16.html └── index.html /latesttweetid.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/latesttweetid.txt: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | index.php 2 | data.txt -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Responsive Astronomy Picture of the Day 2 | 3 | ## Post 4 | 5 | - [https://f90.co.uk/labs/responsive-astronomy-picture-of-the-day/](https://f90.co.uk/labs/responsive-astronomy-picture-of-the-day/) 6 | -------------------------------------------------------------------------------- /index.sample.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |Munging: ' . $text . '
'); 52 | 53 | // condition : does the translation class contain any additional munging techniques? 54 | if (method_exists($this, "additionalMunging")) { 55 | $text = $this->additionalMunging($text, $context); 56 | } 57 | 58 | return $text; 59 | } 60 | } -------------------------------------------------------------------------------- /lib/README.md: -------------------------------------------------------------------------------- 1 | # TweetMunger 2 | 3 | Translate _(mung)_ tweets from a specific user account through a custom dictionary, then re-tweet from a new account. 4 | 5 | 6 | ## Set up 7 | 8 | Setting up a new TweetMunger account will require a few steps: 9 | 10 | * Create a new [Twitter](http://twitter.com/) account 11 | * [Register a new app](https://dev.twitter.com/) with the twitter account - take a note of the four different keys listed below, and make sure the app has read and write access. (Give it read and write access before creating your access tokens so they share this access, to check see [here](https://twitter.com/settings/applications)) 12 | * Pick a custom translation (or create your own) 13 | 14 | 15 | ## Init 16 | 17 | Set up a script on a (php-enabled) web server that calls the TweetMunger class. The following is one example of how you could do it: 18 | 19 | 22 | 23 | 24 | 25 | 26 |46 | 47 | Discover the cosmos! 48 | Each day a different image or photograph of our fascinating universe is 49 | featured, along with a brief explanation written by a professional astronomer. 50 |
51 |
52 | 2011 January 16
53 |
54 |
55 |
67 | 68 | Explanation: 69 | Is it dawn or false dawn? 70 | 71 | During certain times of the year, the horizon near the 72 | rising Sun will begin to glow unusually early. 73 | 74 | This early glow does not originate directly from the Sun, 75 | but rather from sunlight reflected by 76 | interplanetary dust. 77 | 78 | Called 79 | zodiacal light, 80 | the 81 | glowing triangle of light may be mistaken, for a while, for a sunrise, and so may be called a false dawn. 82 | 83 | Pictured above, two false dawns were recorded in time lapse movies each spanning about five hours from the perch of the 85 | highest observatory in the world: Mount Saraswati near 88 | Hanle, 89 | India. 90 | 91 | At its brightest, the rising 92 | zodiacal triangle on the left glows brighter than even the central disk of our Milky Way Galaxy -- 93 | visible as the diagonal 94 | band moving left to right across the frame. 95 | 96 | 97 |
117 | Authors & editors:
118 | Robert Nemiroff
119 | (MTU) &
120 | Jerry Bonnell (UMCP)
122 | NASA Official: Phillip Newman
123 | Specific rights apply.
124 | NASA Web
125 | Privacy Policy and Important Notices
126 | A service of:
127 | ASD at
128 | NASA /
129 | GSFC
130 |
& Michigan Tech. U.
131 |
", $this->updateStart.$this->header.$this->footer.$this->updateEnd."\n", $src); 78 | 79 | // save index file - update latest for directory root 80 | $fp = fopen('../pages/index.html', 'w'); 81 | fwrite($fp, $src); 82 | fclose($fp); 83 | 84 | // save dated file - for twitter 85 | $fp = fopen('../pages/'.$date.'.html', 'w'); 86 | fwrite($fp, $src); 87 | fclose($fp); 88 | 89 | // grab first part of tweet (up to URL) 90 | $description = substr($text, 0, strrpos($text, ": ")); 91 | 92 | // update tweet with new URL 93 | $text = $description . ": ".$date.".html"; 94 | $context->debug('
Additional munging: ' . $text . '
'); 95 | return $text; 96 | } 97 | 98 | 99 | /* 100 | * http://snipplr.com/view.php?codeview&id=4084 101 | * Curl replacement for file_get_contents 102 | */ 103 | private function file_get_contents_curl($url) { 104 | $ch = curl_init(); 105 | 106 | curl_setopt($ch, CURLOPT_HEADER, 0); 107 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser. 108 | curl_setopt($ch, CURLOPT_URL, $url); 109 | 110 | $data = curl_exec($ch); 111 | curl_close($ch); 112 | 113 | return $data; 114 | } 115 | } 116 | 117 | -------------------------------------------------------------------------------- /pages/2012-01-16.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
5 |
6 |
7 |
8 |
9 |
10 |
12 |
13 |
14 |
15 |
16 |
17 |
150 |