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
from __future__ import division | |
from PIL import Image, ImageColor | |
import re | |
color_map = { '10':'A', '11':'B', '12':'C', '13':'D', '14':'E', '15':'F' } | |
def get_parts(number): | |
parts = re.match("^([0-9]+)\.([0-9]+)", str(number)) | |
return (parts.group(1), parts.group(2)) |
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
from __future__ import division | |
from PIL import Image, ImageColor | |
import re | |
color_map = { '10':'A', '11':'B', '12':'C', '13':'D', '14':'E', '15':'F' } | |
def get_parts(number): | |
parts = re.match("^([0-9]+)\.([0-9]+)", str(number)) | |
return (parts.group(1), parts.group(2)) |
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 | |
class MainHandler { | |
function get() { | |
echo "Hello, world"; | |
} | |
} | |
Toro::serve(array( | |
"/" => "MainHandler", |
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 | |
require_once 'toro.php'; | |
$blog_posts = array( | |
array('title' => 'Evening Plans', 'body' => "I'm staying in to work on my law blog."), | |
array('title' => "You don't need double talk; you need Bob Loblaw", 'body' => 'True.'), | |
array('title' => "Why should you go to jail for a crime someone else noticed?", 'body' => "You shouldn't."), | |
); | |
function display_snippet($pos) { |
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 | |
ToroHook::add('before_request', function() { echo 'Before Request'; }); | |
ToroHook::add('after_request', function() { echo 'After Request'; }); | |
class SomeHandler extends ToroHandler { | |
public function __construct() { | |
ToroHook::add('before_handler', function() { echo 'Before Handler'; }); | |
ToroHook::add('after_handler', function() { echo 'After Handler'; }); | |
} |
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
<? | |
function prepare_named_routes($matches) { | |
return "([a-zA-Z0-9-_]+)"; | |
} | |
// Have a URL | |
$url = "/user/dude/rug"; | |
// Prepare the route | |
$route = "user/:username/:action"; |
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
<? | |
function seppuku() { | |
header("HTTP/1.1 500 Internal Server Error"); | |
ob_clean(); | |
} | |
register_shutdown_function("seppuku"); |
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
<? | |
class ToroRoute { | |
function __construct($route, $patterns) { | |
} | |
public function matches_url($url) { | |
} | |
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
Just got the following spam message. Pretty entertaining. | |
----- | |
My name is Captain Matthew Stamford of the US Marine corps (special) stationed in Pakistan, | |
I found some money ($2,000,000.00) after the death of Osama Bin Laden. I need someone to help me move it to a safer place, | |
please have it in mind that there is no danger involved. You may contact me on matt.stam57@yahoo.com.hk so that I can provide you with details |
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
// Invert the color spectrum | |
Surface::Iter iter(newSurface.getIter()); | |
while(iter.line()) { | |
while(iter.pixel()) { | |
iter.r() = 255 - iter.r(); | |
iter.g() = 255 - iter.g(); | |
iter.b() = 255 - iter.b(); | |
} | |
} |