Skip to content

Instantly share code, notes, and snippets.

View avdg's full-sized avatar

Anthony Van de Gejuchte avdg

View GitHub Profile
phpunit --coverage-html ./phpunitCache/ Request/
<html>
<head>
<style type="text/css">
body {
font-family: monospace;
background-color: #F6FFE9;
}
#code_error td.title {
font-weight: bold;
@avdg
avdg / gist:972364
Created May 14, 2011 16:36
Getting grid to 2d problem *solved: I had declared 9 rows on such a way it was stored as 1 row and 8 others that refers to them*
def getSudoku(self):
sudoku = [[0] * 9 for x in range(9)]
for x, rows in enumerate(self.sudoku):
for y, cell in enumerate(rows):
if len(cell) == 1:
sudoku[x][y] = cell[0]
return sudoku
<?php
class Phergie_Plugin_Cache_Backend_SqLite extends Phergie_Plugin_Cache_Backend
{
protected $db;
protected $prepareIsset;
protected $prepareFetch;
protected $prepareStoreUpdate;
protected $prepareStoreInsert;
protected $prepareExpire;
@avdg
avdg / gist:939889
Created April 24, 2011 21:23
Files with DOS eol style in PPI framework
App.php
Autoload.php
Cache/Disk.php
Config.php
Dispatch.php
Helper.php
Model/Upload.php
Session.php
Vendor/Smarty/Config_File.class.php
Vendor/Smarty/internals/core.load_plugins.php
@avdg
avdg / on master.diff
Created April 18, 2011 17:52
Current diff
diff --git a/Phergie/Plugin/Weather.php b/Phergie/Plugin/Weather.php
index c12d15e..531c8e7 100644
--- a/Phergie/Plugin/Weather.php
+++ b/Phergie/Plugin/Weather.php
@@ -32,6 +32,7 @@
* @license http://phergie.org/license New BSD License
* @link http://pear.phergie.org/package/Phergie_Plugin_Weather
* @link http://www.weather.com/services/xmloap.html
+ * @uses Phergie_Plugin_Cache pear.phergie.org
* @uses Phergie_Plugin_Command pear.phergie.org
<?php
// A class to help work with Sessions
// In our case, primarily to manage logging users in and out
// Keep in mind when working with sessions that it is generally
// inadvisable to store DB-related objects in sessions
class Session {
private $logged_in=false;
LICENSE
Phergie/Autoload.php
Phergie/Bot.php
Phergie/Config/Exception.php
Phergie/Config.php
Phergie/Connection/Exception.php
Phergie/Connection/Handler.php
Phergie/Connection.php
Phergie/Driver/Abstract.php
Phergie/Driver/Exception.php
create table general {
id INTEGER UNIQUE PRIMARY KEY,
userhash BLOB UNIQUE,
userid INTEGER,
ship TEXT,
time INT,
version TEXT,
fate TEXT,
player TEXT,
score INT,
db cache.db
table namespace1
key
value
expire
table namespace2
key
value
expire
table namespace3
<?php
function curl_get_contents($url, $timeout = 30, $settings_array = array())
{
$return false;
if (function_exists("curl_init")) {
$curl_options = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => intval($timeout),
CURLOPT_HEADER => false