This file contains hidden or 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 | |
/* | |
Enables a PHP page to abstract out the site design (the template) from | |
the page design (the content). | |
Generally, a page will have a common header and footer (sidebars and the | |
like would live in one or the other). Following this pattern, a new page | |
can be created (after including the necessary files of course)) like so: |
This file contains hidden or 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
<code><pre> | |
<?php | |
echo "__FILE__: ".__FILE__."\n"; | |
echo "PHP_SELF: ".$_SERVER['PHP_SELF']."\n"; | |
echo "SCRIPT_NAME: ".$_SERVER['SCRIPT_NAME']."\n"; | |
echo "REQUEST_URI: ".$_SERVER['REQUEST_URI']."\n"; | |
echo "parse_url(REQUEST_URI): ".parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH)."\n"; | |
?> |
This file contains hidden or 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
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
/** | |
* Runnable which causes a heavy yet stable amount of GC; useful for | |
* benchmarking applications under load. | |
* |
This file contains hidden or 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
import java.io.*; | |
import java.util.*; | |
import com.google.common.collect.*; | |
public class WordFreq { | |
public static void main(String[] args) throws FileNotFoundException { | |
final HashMultiset<String> counts = HashMultiset.create( | |
ImmutableList.copyOf(new Scanner(new File(args[0])))); | |
This file contains hidden or 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 | |
/* | |
This file handles all necessary setup that has to happen on each page load. | |
It should have no need to be aware of where the server is running from. | |
*/ | |
session_start(); | |
// This file isn't tracked by version control, and might not exist |
This file contains hidden or 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
''' | |
Tests different methods of concatenating files in Python. | |
''' | |
from __future__ import print_function | |
import json,os,shutil,subprocess | |
import util | |
def verify(file,expected): | |
count = 0 |
This file contains hidden or 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
import bisect | |
import error; | |
class Prefix: | |
''' | |
A prefix data structure built on a sorted list, which uses binary search. | |
Note that for more reasonable lookup, it only searches in lower | |
case. This means there can be colliding strings such as 'prefix' vs 'Prefix'. | |
In this case, more recent inserts override older ones. |
NewerOlder