This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a list of classes that can be taken (i.e. do not cause conflicts with other classes and can be used | |
* in a valid schedule.) from the given courses. | |
* | |
* Note that this function (the while loop in particular) is a significant performance bottleneck | |
* | |
* @param ARRAY $courses List of course objects to consider. | |
* @return MIXED A list of valid classes or a string with the error message(s). | |
*/ | |
function findSchedules(array $courses) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
aaa|bbb* | |
| = green | |
* = yellow | |
1. Strip off any leading red | |
2. Assume a > b (a has a red before b does) | |
2a. If a > b assumption holds and len(a) >= len(b), accept | |
3. If len(a) < len(b), reject | |
4. If len(a) > len(b), accept |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Fetching some of the older backgrounds requires the PHP rar extension (available through pecl). If this extension is not installed, those images will be skipped. | |
for($i = 1; true; $i++) { | |
$tmpDir = sys_get_temp_dir(); | |
if(substr($tmpDir, -1) != '/') { | |
$tmpDir .= '/'; | |
} | |
if(file_exists($tmpDir.'imageList'.$i)) { | |
$imageListPage = file_get_contents($tmpDir.'imageList'.$i); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"context" | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"runtime/debug" |