Skip to content

Instantly share code, notes, and snippets.

@reaneyk
reaneyk / gist:3744228
Created September 18, 2012 16:47
oauth2app update
--- authorize.py.orig 2012-09-18 09:45:28.150774353 -0700
+++ authorize.py 2012-09-18 09:45:54.117029452 -0700
@@ -310,7 +310,7 @@ class Authorizer(object):
fragments["token_type"] = "bearer"
access_token.save()
if self.state is not None:
- parameters['state'] = self.state
+ fragments['state'] = self.state
redirect_uri = add_parameters(self.redirect_uri, parameters)
redirect_uri = add_fragments(redirect_uri, fragments)
@reaneyk
reaneyk / gist:4075393
Created November 14, 2012 22:46
Simple mobile device detection
<?php
preg_match('/(Android|iPad|iPhone|iPod)/', $_SERVER['HTTP_USER_AGENT'], $mobile_device);
if(!empty($mobile_device)) {
print 'By George, we have a mobile device.';
}
?>
@reaneyk
reaneyk / gist:6604523
Last active June 29, 2022 16:57
Example PHP Abstract Class
<?php
//Define a new Abstract class for all 'shapes' to extend
abstract class Shape {
//Define the methods required for classes to extend
//the abstract class
abstract protected function getColor();
abstract protected function setColor($color);
@reaneyk
reaneyk / gist:6604607
Created September 18, 2013 04:39
Example PHP Interface class
<?php
//Define a new Interface for all 'shapes' to inherit
interface Shape {
//Define the methods required for classes to implement
public function getColor();
public function setColor($color);