I put this little guide together as I installed Ubuntu 13.04.
Installing
- Apache
- MySQL
- PHP 5.4
- PHP-FPM
// Create a new thread inside your Actvity. | |
Thread thread = new Thread() { | |
@Override | |
public void run() { | |
// Block this thread for 2 seconds. | |
try { | |
Thread.sleep(2000); | |
} catch (InterruptedException e) { |
/** Return the distance between two points */ | |
public static double distance(float x1, float y1, float x2, float y2) { | |
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)); | |
} |
# Find External IP Address | |
curl icanhazip.com | |
# Install Composer | |
curl -sS https://getcomposer.org/installer | php |
<?php | |
/** | |
* Convert a human-readable string to a boolean. | |
* | |
* Case insensitively treats true, t, yes, y, and 1 as true. | |
* Anything else is false. | |
* | |
* @param string $str | |
* @return bool |
def normalize_line_endings(string, eol): | |
"""Return a string with consistent line endings.""" | |
string = string.replace("\r\n", "\n").replace("\r", "\n") | |
if eol != "\n": | |
string = string.replace("\n", eol) | |
return string |
class OverrideableSettings(): | |
""" | |
Class for adding a layer of overrides on top of a Settings object | |
The class is read-only. If a dictionary-like _overrides member is present, | |
the get() method will look there first for a setting before reading from | |
the _settings member. | |
""" | |
def __init__(self, settings=None, overrides=None): |
<?php | |
/** | |
* Convert GFM-style code blocks to HTML for use with SyntaxHighlighter | |
* | |
* @param string $text | |
* @return string | |
*/ | |
function fencedCodeBlocksToHtml($text) | |
{ |
<?php | |
/** | |
* Autoload function adapted from from PSR-0 standard. | |
* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md#splclassloader-implementation | |
*/ | |
function autoload($className) | |
{ | |
$className = ltrim($className, '\\'); | |
$fileName = ''; |
<VirtualHost *:80> | |
ServerName bad-domain.com | |
ServerAlias www.bad-domain.com | |
Redirect / http://www.good-domain.com | |
</VirtualHost> |