├── .gitignore ├── README.md ├── offcampus.css ├── stops.xml ├── stops-list ├── index.php └── nbuxml.xml /.gitignore: -------------------------------------------------------------------------------- 1 | cache 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WherethefuckRU 2 | -------------- 3 | 4 | This was some of the very first Javascript code I wrote in 2011. 5 | 6 | WherethefuckRU is a web application that helps you figure out where a certain address is relative to predefined landmarks. The application as it's written works with addresses around Rutgers University, and tells you how close an address is to bus stops. 7 | 8 | I built it because I was looking for offcampus housing and I wanted to search an address, and quickly understand its location. 9 | 10 | The live version is available at [http://wherethefuckru.vverma.net/](http://wherethefuckru.vverma.net/). 11 | -------------------------------------------------------------------------------- /offcampus.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #aaa; 3 | } 4 | 5 | #center { 6 | width: 800px; 7 | background-color: #ffffff; 8 | margin-right: auto; 9 | margin-left: auto; 10 | margin-top: 20px; 11 | margin-bottom: 20px; 12 | -moz-box-shadow: 0px 1px 1px #000; 13 | -webkit-box-shadow: 0px 1px 1px #000; 14 | box-shadow: 0px 1px 1px #000; 15 | border-radius: 10px; 16 | -moz-border-radius: 10px; 17 | border: 35px solid #fff; 18 | } 19 | 20 | h1 { 21 | font-size: 40px; 22 | letter-spacing: 1px; 23 | margin-bottom: 10px; 24 | } 25 | 26 | h1 span#red { 27 | color: #a00; 28 | } 29 | 30 | form#stop-form { 31 | padding-top: 20px; 32 | padding-left: 20px; 33 | padding-bottom: 20px; 34 | } 35 | 36 | #help-link { 37 | font-size: 12px; 38 | } 39 | 40 | #help-text { 41 | font-size: 12px; 42 | } 43 | 44 | #closest_span { 45 | text-align: center; 46 | } 47 | 48 | #copyright { 49 | text-align: center; 50 | } 51 | -------------------------------------------------------------------------------- /stops.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /stops-list: -------------------------------------------------------------------------------- 1 | a:10:{i:0;a:5:{s:3:"tag";s:5:"scott";s:5:"title";s:10:"Scott Hall";s:3:"lat";s:9:"40.499567";s:3:"lon";s:10:"-74.448238";s:6:"stopId";s:4:"1055";}i:1;a:5:{s:3:"tag";s:8:"traine_a";s:5:"title";s:13:"Train Station";s:3:"lat";s:9:"40.498187";s:3:"lon";s:10:"-74.445195";s:6:"stopId";s:4:"1064";}i:2;a:5:{s:3:"tag";s:10:"stuactcntr";s:5:"title";s:25:"Student Activities Center";s:3:"lat";s:7:"40.5041";s:3:"lon";s:10:"-74.449091";s:6:"stopId";s:4:"1001";}i:3;a:5:{s:3:"tag";s:7:"busch_a";s:5:"title";s:19:"Busch Campus Center";s:3:"lat";s:9:"40.523768";s:3:"lon";s:10:"-74.458305";s:6:"stopId";s:4:"1008";}i:4;a:5:{s:3:"tag";s:5:"quads";s:5:"title";s:5:"Quads";s:3:"lat";s:8:"40.51992";s:3:"lon";s:10:"-74.433583";s:6:"stopId";s:4:"1030";}i:5;a:5:{s:3:"tag";s:7:"livstud";s:5:"title";s:25:"Livingston Student Center";s:3:"lat";s:9:"40.523959";s:3:"lon";s:10:"-74.436622";s:6:"stopId";s:4:"1030";}i:6;a:5:{s:3:"tag";s:9:"college_a";s:5:"title";s:12:"College Hall";s:3:"lat";s:9:"40.485633";s:3:"lon";s:10:"-74.437406";s:6:"stopId";s:4:"1052";}i:7;a:5:{s:3:"tag";s:8:"zimmerli";s:5:"title";s:20:"Zimmerli Arts Museum";s:3:"lat";s:9:"40.499666";s:3:"lon";s:10:"-74.445021";s:6:"stopId";s:4:"1017";}i:8;a:5:{s:3:"tag";s:10:"rutgerss_a";s:5:"title";s:22:"Rutgers Student Center";s:3:"lat";s:9:"40.502681";s:3:"lon";s:10:"-74.451444";s:6:"stopId";s:4:"1062";}i:9;a:5:{s:3:"tag";s:7:"pubsafn";s:5:"title";s:22:"Public Safety Building";s:3:"lat";s:9:"40.487978";s:3:"lon";s:10:"-74.439329";s:6:"stopId";s:4:"1016";}} 2 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | '; 6 | print_r($text); 7 | echo ''; 8 | } 9 | 10 | if(file_exists('cache')) 11 | $cache = unserialize(file_get_contents('cache')); 12 | else 13 | $cache = array(); 14 | 15 | if(isset($_REQUEST['debug'])) 16 | { 17 | debug_r($_REQUEST); 18 | debug_r($cache); 19 | $debug = 1; 20 | } 21 | ?> 22 | 23 | 24 | 25 | 26 | WherethefuckRU - Rutgers Off Campus Bus Stop Assistant 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 |

WherethefuckRU

37 | What's this? 38 |
39 | Hide 40 |

WherethefuckRU is a service that allows you to search an address around Rutgers, and figure out where it is relative to common bus stops. It shows you a map of walking directions from the closest bus stop. This is especially useful if you are looking for Off Campus housing.

41 |
42 | 43 |
44 | Address
45 |
46 |
47 | Stops to search:
48 |     '.$stop['title'].'
'; 54 | } 55 | 56 | ?> 57 | 58 | 59 | 60 |
61 | 62 |
63 | 64 | 180 | 181 |
182 | 183 | 184 | 185 | 186 |
187 | 188 | "; 200 | $origin .= ' near New Brunswick, NJ'; 201 | 202 | $origin = strtolower($origin); 203 | ?> 204 | 205 | 206 | 207 | 208 | 209 | 210 | "; 224 | } 225 | 226 | $query_params = array( 227 | 'origin' => $geocoded_origin, 228 | 'destination' => $stop['lat'].','.$stop['lon'], 229 | ); 230 | 231 | $url = $url.http_build_query($query_params); 232 | 233 | $content = file_get_contents($url); 234 | $result = json_decode($content); 235 | 236 | if(isset($debug)) 237 | debug_r($result); 238 | 239 | $latlong = (string)($result->routes[0]->legs[0]->start_location->lat.','.$result->routes[0]->legs[0]->start_location->lng); 240 | 241 | // echo "Caching ".$geocoded_origin.' latlon '.$latlong.'
'; 242 | $cache[$geocoded_origin] = $latlong; 243 | 244 | // debug_r($cache); 245 | 246 | 247 | $duration = $result->routes[0]->legs[0]->duration->value; 248 | $duration_text = $result->routes[0]->legs[0]->duration->text; 249 | 250 | $distance = $result->routes[0]->legs[0]->distance->text; 251 | 252 | echo ''; 253 | echo ''; 254 | echo ''; 255 | echo ''; 256 | echo ''; 257 | 258 | if(!$minresult) 259 | { 260 | $minresult = $result->routes[0]->legs[0]; 261 | $minstop = $stop; 262 | } 263 | if($minresult->duration->value > $duration) 264 | { 265 | $minresult = $result->routes[0]->legs[0]; 266 | $minstop = $stop; 267 | } 268 | } 269 | 270 | echo '
Stop Distance Walking Time
'.$stop['title']. ' '.$distance. ' '.$duration_text. '
'; 271 | 272 | file_put_contents('cache', serialize($cache)); 273 | 274 | echo "The closest stop is ".$minstop['title']." which is ".$minresult->distance->text." away and a ".$minresult->duration->text." walk.\n
"; 275 | 276 | $origin_arr = explode(',', $geocoded_origin); 277 | $origin_lat = $origin_arr[0]; 278 | $origin_lon = $origin_arr[1]; 279 | 280 | $dest_lat = $minstop['lat']; 281 | $dest_lon = $minstop['lon']; 282 | ?> 283 | 284 | 285 | 290 | 291 | 292 | 293 |
294 | 295 | 296 | 297 | -------------------------------------------------------------------------------- /nbuxml.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | --------------------------------------------------------------------------------