Skip to content

Instantly share code, notes, and snippets.

View samsoir's full-sized avatar

Sam de Freyssinet samsoir

View GitHub Profile
HTTP/1.1 200 OK
Content-Type: application/json
{
contentType:"ssoUser",
metadata:
{
total: 1,
fetchedRows: 1,
limit: null,
@samsoir
samsoir / gist:1151284
Created August 17, 2011 10:28
Memtest output from MacBook Pro Test
Memtest version 4.22 (64-bit)
Copyright (C) 2004 Charles Cazabon
Copyright (C) 2004-2008 Tony Scaminaci (Macintosh port)
Licensed under the GNU General Public License version 2 only
Mac OS X 10.7 (11A511) running in multiuser mode
Memory Page Size: 4096
System has 8 Intel core(s) with SSE
Requested memory: 4061MB (4259139584 bytes)
Available memory: 4061MB (4259139584 bytes)
; <<>> DiG 9.7.3 <<>> @localhost reyssi.net
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62334
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; QUESTION SECTION:
;reyssi.net. IN A
;
; BIND data file for reyssi.net
;
$TTL 604800
@ IN SOA ns1.reyssi.net. info.reyssi.net. (
2011072408 ; Serial
7200 ; Refresh
120 ; Retry
2419200 ; Expire
604800) ; Default TTL
@samsoir
samsoir / request.php
Created July 23, 2011 14:07
New Request::redirect() api for 3.2 and 3.1.4
<?php
/**
* Redirects as the request response. If the URL does not include a
* protocol, it will be converted into a complete URL.
*
* $request->redirect($url);
*
* [!!] No further processing can be done after this method is called!
*
* @param string $url Redirect location
<?php
class Database_Result extends Kohana_Database_Result
{
public function as_json()
{
$result = array();
foreach ($this as $key => $value)
diff --git a/webroot/index.php b/webroot/index.php
index 3bc2bfa..478ffe9 100755
--- a/webroot/index.php
+++ b/webroot/index.php
@@ -137,9 +137,20 @@ if(Kohana::$environment != Kohana::DEVELOPMENT && !$authorized()){
echo Kohana::config('asciiart.grumbletonian');
exit;
} else {
- // Added cache instance of memcache to enable HTTP caching
- echo Request::factory(TRUE, Cache::instance('memcache'))
@samsoir
samsoir / pom.xml
Created April 28, 2011 13:33
Example Kohana Maven RPM packing script
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.kohana.framework</groupId>
<artifactId>kohana-framework</artifactId>
<name>${pom.artifactId}</name>
<description>
Kohana is an elegant HMVC PHP5 framework that provides
a rich set of components for building web applications.
</description>
@samsoir
samsoir / SapphireTest.php.patch
Created April 26, 2011 12:44
Quick fix for SapphireTest.php that allows unit tests to run
diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php
index aac12cc..b5727a4 100755
--- a/dev/SapphireTest.php
+++ b/dev/SapphireTest.php
@@ -364,7 +364,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
ini_set('memory_limit', ($this->originalMemoryLimit) ? $this->originalMemoryLimit : -1);
// Restore email configuration
- Email::set_mailer($this->originalMailer);
+ ($this->originalMailer instanceof Mailer) and Email::set_mailer($this->originalMailer);
@samsoir
samsoir / reset-sqlserver.py
Created April 21, 2011 16:37
Resets the SQLServer 2008R2 Database from the Linux Box
#!/usr/bin/python
# +--------------------------------------------------------------------------+
# | OU Annotate SQL Server reset DB |
# | Written by Sam de Freyssinet |
# +--------------------------------------------------------------------------+
# | Permission to use, copy, modify, and/or distribute this software for any |
# | purpose with or without fee is hereby granted, provided that the above |
# | copyright notice and this permission notice appear in all copies. |
# +--------------------------------------------------------------------------+
# | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |