Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View philsturgeon's full-sized avatar
🌳
Planting Trees

Phil Sturgeon philsturgeon

🌳
Planting Trees
View GitHub Profile
@philsturgeon
philsturgeon / gist:8826220
Created February 5, 2014 15:35
PHP - So close, but yet so far.
$ python
Python 2.7.5 (default, Oct 21 2013, 17:28:33)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
[>>> [1, 3, 5] + [345, 6]
[1, 3, 5, 345, 6]
>>>
$ php -a
Interactive shell
@philsturgeon
philsturgeon / gist:11284868
Created April 25, 2014 10:30
Python UTF-8 Fun
Traceback (most recent call last):
File "facebook_cover.py", line 44, in <module>
photo = graph.put_photo(image_resource, album_id=payload['page_id'])
File "/task/__pips__/facebook.py", line 219, in put_photo
data = urllib2.urlopen(req).read()
File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 400, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 418, in _open
@philsturgeon
philsturgeon / import_cars_test.go
Created November 23, 2014 18:10
Test Remote CSV Downlaod
package main
import (
"testing"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
)
<?php
$foo = "global";
include "namespaced.php";
echo $foo; // Outputs: "something"
<?php
require(APPPATH.'/libraries/REST_Controller.php');
class Example_api extends REST_Controller {
function user_get()
{
//$user = $this->some_model->getSomething( $this->get('id') );
$user = array('id' => $this->get('id'), 'name' => 'Some Guy', 'email' => 'example@example.com');
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* @author Philip Sturgeon
* @created 04/06/2009
*/
class REST {
private $CI; // CodeIgniter instance
<?php
class Rest_test extends Controller {
function __construct() {
parent::Controller();
$this->load->library('rest', array('server' => 'http://localhost/codeigniter/index.php/example_api/'));
}
function user_list()
/*
* jQuery Cycle plugin v0.2
* Philip Sturgeon [http://philsturgeon.co.uk]
*
* Licensed under the WTFPL License
* http://sam.zoy.org/wtfpl/
*/
(function($)
{
<?php
/**
* Matchbox Loader class
*
* This file is part of Matchbox
*
* Matchbox is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 4.3.2 or newer
*
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, EllisLab, Inc.
* @license http://www.codeignitor.com/user_guide/license.html