Skip to content

Instantly share code, notes, and snippets.

<IfModule mod_python.c>
<FilesMatch "\.py$">
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug on
</FilesMatch>
</IfModule>
$(document).ready(function(){
$(".click").toggle(function(){
$("#box").css("-webkit-transform","scale(2.1) rotate(-90deg)"); },
function () {
$("#box").css("-webkit-transform","scale(1) rotate(0)");
})
})
require_once __DIR__.'/silex.phar';
$app = new Silex\Application();
$app->get('/hello/{name}', function($name) {
return "Hello $name";
});
$app->run();
@siygle
siygle / gist:1010082
Created June 6, 2011 11:20
Silex Extension Interface
<?php
namespace Silex;
interface ExtensionInterface
{
function register(Application $app);
}
?>
@siygle
siygle / gist:1010088
Created June 6, 2011 11:22
Silex Hello World!!
<?php
require_once __DIR__.’/silex.phar’;
$app = new SilexApplication();
$app->get(‘/hello/{name}’, function($name) {
return "Hello $name";
});
$app->run();
?>
@siygle
siygle / gist:1010750
Created June 6, 2011 18:16
Example of Dependency Injection
<?php
class User {
protected $outfit = array();
function __construct() {
$store = new Store();
array_push($this->outfit, $store->getCloth());
array_push($this->outfit, $store->getShoes());
}
<?php
require_once 'Twig/Autoloader.php';
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem('templates');
$config = array(
'cache' => 'cache',
);
$twig = new Twig_Environment($loader, $config);
<!-- layout.html.twig -->
<!DOCTYPE HTML>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css" />
<title>Welcome to Twig</title>
</head>
<body>
<div id="content">{% block content %}{% endblock %}</div>
</body>
@siygle
siygle / gist:1062418
Created July 3, 2011 17:52
WordPress XMLRPC sample
<?php
$username = '';
$password = '';
$blogid = ''; // Can get using wp.getUsersBlogs
$target_host = '';
$xmlrpc_method = '';
function get_response($url, $context){
if(!function_exists('curl_init')){
@siygle
siygle / test.php
Created July 15, 2011 18:45
Monolog example
<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
//create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('/path/to/log', Logger::WARNING));
// add records to the log