Skip to content

Instantly share code, notes, and snippets.

@toopay
toopay / selenium.sh
Created December 1, 2012 13:02
Bash Script to enable Selenium on Travis Hook
#!/bin/bash
case "${1:-''}" in
'start')
if test -f /tmp/selenium.pid
then
echo "Selenium is already running."
else
java -jar /usr/lib/selenium/selenium-server-standalone-2.21.0.jar > /var/log/selenium/selenium-output.log 2> /var/log/selenium/selenium-error.log & echo $! > /tmp/selenium.pid
echo "Starting Selenium..."
@toopay
toopay / core.php
Created November 6, 2012 09:29
Gas Core Class Patch
<?php namespace Gas;
/**
* CodeIgniter Gas ORM Packages
*
* A lighweight and easy-to-use ORM for CodeIgniter
*
* This packages intend to use as semi-native ORM for CI,
* based on the ActiveRecord pattern. This ORM uses CI stan-
* dard DB utility packages also validation class.
@toopay
toopay / CustomContent.php
Created October 25, 2012 04:45
Observer sample
<?php
namespace App;
use Juriya\Pattern\Observer;
use Juriya\ResponseHttp;
class CustomContent implements Observer {
public static function onExecute($observable, $arguments)
@toopay
toopay / ActionController.php
Created October 23, 2012 13:35
Action controller with arguments proxy
//...
/**
* Serve HTTP request
*
* @param string
* @param string
* @return response
*/
public function executeHttp($proxy = 'Home', $method = 'index', $id = NULL)
{
@toopay
toopay / routes.yml
Created October 23, 2012 12:47
Three level path router
# Default route rule
default:
controller: \App\ActionController
arguments:
- '/^[a-zA-Z]+$/'
action:
controller: \App\ActionController
arguments:
- '/^[a-zA-Z]+$/'
@toopay
toopay / Juriya.php
Created October 23, 2012 12:44
Skip factory validation
// Try to transform path into socket name
// Change this lines
//try {
// $socket = Request::factory(implode('.', $request->getPath()),
// $request->getArguments(),
// $request->getTunnel())->getSocket();
//} catch (\Exception $e) {
// throw new \RuntimeException($e->getMessage());
//}
// into :
@toopay
toopay / test.php
Created October 15, 2012 06:51
SplClassLoader Example
<?php
// Let say we have these directory structure, that follow PSR-0 spec :
//
// system
// - framework
// - Http
// - Request.php
// - Response.php
// test.php
@toopay
toopay / index.php
Created October 4, 2012 05:25
Juriya App Socket
<?php
require_once 'Juriya/Juriya.php';
use Juriya\Juriya;
use Juriya\Collection;
use Juriya\Request;
use Juriya\Controller;
use Juriya\ResponseHttp;
@toopay
toopay / index.php
Created September 13, 2012 10:58
Explicit Front Socket
<?php
require_once 'Juriya/Juriya.php';
use Juriya\Juriya;
use Juriya\Collection;
use Juriya\Request;
use Juriya\Controller;
use Juriya\ResponseHttp;
@toopay
toopay / Hello.php
Created August 11, 2012 06:01
Juriya Controller Example
<?php namespace App;
/**
* Juriya - RAD PHP Framework
*
* Hello controller
*
* @package Juriya
* @category controller
* @version 0.1.1