Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Phil Sturgeon philsturgeon

🏠
Working from home
View GitHub Profile
@philsturgeon
philsturgeon / gist:8826220
Created Feb 5, 2014
PHP - So close, but yet so far.
View gist:8826220
$ 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
View gist:11284868
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 Nov 23, 2014
Test Remote CSV Downlaod
View import_cars_test.go
package main
import (
"testing"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
)
View example.php
<?php
$foo = "global";
include "namespaced.php";
echo $foo; // Outputs: "something"
View example_api.php
<?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');
View REST.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* @author Philip Sturgeon
* @created 04/06/2009
*/
class REST {
private $CI; // CodeIgniter instance
View Rest_test.php
<?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()
View jquery.cycle.js
/*
* jQuery Cycle plugin v0.2
* Philip Sturgeon [http://philsturgeon.co.uk]
*
* Licensed under the WTFPL License
* http://sam.zoy.org/wtfpl/
*/
(function($)
{
View Matxhbox with Library Subfolders
<?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
View [OLD] Video convertion library
<?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
You can’t perform that action at this time.