Skip to content

Instantly share code, notes, and snippets.

<?php require_once(__DIR__.'/../../vendor/autoload.php');
use Guzzle\Http\Client;
use Guzzle\Common\Event;
use Guzzle\Http\Message\Request;
use Guzzle\Http\Message\Response;
use Guzzle\Http\Exception\BadResponseException;
$url = 'http://www.amazon.com';
$client = new Client($url);
module-{{ global:module }}{{
if page:id
}} page-id-{{ page:id }}{{
if page:is_home
}} home{{
endif }}{{
endif }}{{
if user:logged_in
$url = "http://factoryjoe.com/projects/emoticons/";
$html = file_get_contents($url);
$doc = new DOMDocument();
$doc->strictErrorChecking = FALSE;
$doc->loadHTML($html);
$xml = simplexml_import_dom($doc);
$flags = array();
foreach ($xml->body->div->div->table[1]->tbody->tr as $value)
<?php // bundles/api_v1/controllers/example.php
class Api_V1_Example_Controller extends Controller
{
public $restful = True;
public function get_hello($name='World')
{
return "Hello, {$name}!";
}
@huglester
huglester / upgrade_nginx.sh
Created October 13, 2012 12:10 — forked from perusio/upgrade_nginx.sh
Post Installation script from debian that upgrades Nginx the proper way, i.e., without downtime
#!/bin/sh
set -e
case "$1" in
configure)
if [ -z $2 ] && [ ! -e /etc/nginx/sites-enabled/default ] ;
then
ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
fi
@huglester
huglester / gist:3849204
Created October 7, 2012 18:44 — forked from tomschlick/gist:3812085
FuelPHP 1.x Composer Support
// Add this right after Autoloader::register() in app/bootstrap.php
// In this current setup it will read composer packages from fuel/app/vendor, you can change this below
// Make sure to also setup your composer.json with the correct path
$namespaces = require APPPATH.'vendor/composer/autoload_namespaces.php';
foreach ($namespaces as $namespace => $filepath)
{
Autoloader::add_namespace($namespace, $filepath.$namespace.DS, true);
}
@huglester
huglester / csrf.php
Created October 23, 2011 07:10 — forked from dhrrgn/csrf.php
Simple, yet effective CSRF class for FuelPHP.
<?php
/**
* Simple, yet effective CSRF class for FuelPHP.
*
* @author Dan Horrigan
* @license MIT License
* @copyright 2011 Dan Horrigan
*/
/**