Skip to content

Instantly share code, notes, and snippets.

View wilr's full-sized avatar

Will Rossiter wilr

View GitHub Profile
@wilr
wilr / capfile
Created May 25, 2012 03:12
RemoteRsycCacheSubdir Capistrano Task
#
# Load plugins
#
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
require 'railsless-deploy'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
@wilr
wilr / twitter_diff.diff
Created June 19, 2012 07:19
ENHANCEMENT: update module to support 3.0 api. FEATURE: module now fires an 'authchanged' javascript event to allow site UI updates. ENHANCEMENT: store uses access token to allow offline publishing. Twitter access tokens never expire. BUGFIX: fix throwing
diff -urN --exclude=.piston.yml --exclude=.git --exclude=.svn /Users/Will/Sites/justsold/.twitter.tmp/Authenticator/LoginForm.php /Users/Will/Sites/justsold/twitter/Authenticator/LoginForm.php
--- /Users/Will/Sites/justsold/.twitter.tmp/Authenticator/LoginForm.php 2012-06-19 19:13:19.000000000 +1200
+++ /Users/Will/Sites/justsold/twitter/Authenticator/LoginForm.php 2012-06-12 20:39:03.000000000 +1200
@@ -1,6 +1,7 @@
<?php
class TwitterLoginForm extends LoginForm {
+
protected $authenticator_class = 'TwitterAuthenticator';
@wilr
wilr / twitter_user_diff.diff
Created June 19, 2012 07:45
Updates to CurrentMember
diff --git a/twitter/Controllers/Callback.php b/twitter/Controllers/Callback.php
index 38fa88c..33f9ab4 100644
--- a/twitter/Controllers/Callback.php
+++ b/twitter/Controllers/Callback.php
@@ -39,10 +39,11 @@ class TwitterCallback extends Controller {
public function FinishTwitter($request) {
$token = SecurityToken::inst();
if(!$token->checkRequest($request)) return $this->httpError(400);
- if($this->CurrentMember()->TwitterID) {
+
@wilr
wilr / facebook_changes.diff
Created June 19, 2012 07:49
ENHANCEMENT: update module to support 3.0 api. FEATURE: add ability to request extended permissions. ENHANCEMENT: use classes rather than IDs for connect buttons to allow multiple per page.
diff -urN --exclude=.piston.yml --exclude=.git --exclude=.svn /Users/Will/Sites/justsold/.facebook.tmp/Authenticator/LoginForm.php /Users/Will/Sites/justsold/facebook/Authenticator/LoginForm.php
--- /Users/Will/Sites/justsold/.facebook.tmp/Authenticator/LoginForm.php 2012-06-19 19:43:58.000000000 +1200
+++ /Users/Will/Sites/justsold/facebook/Authenticator/LoginForm.php 2012-06-12 20:38:27.000000000 +1200
@@ -1,6 +1,7 @@
<?php
class FacebookLoginForm extends LoginForm {
+
protected $authenticator_class = 'FacebookAuthenticator';
@wilr
wilr / Tweet.php
Created July 6, 2012 03:38
A simple SilverStripe PHP class for loading a stream of tweets from a XML file.
<?php
/**
* Loads tweets onto a SilverStripe object through a XML file rather than the
* web API.
*
* Usage:
*
* // PHP
* function Tweets() {
@wilr
wilr / .htaccess
Created August 6, 2012 06:26
XHProf
php_value auto_prepend_file header.php
php_value auto_append_file footer.php
@wilr
wilr / app._config.routes.yml
Created September 15, 2012 00:29
Basic SilverStripe 3.0 Framework Bootstrap
---
Name: app
After: framework/routes#coreroutes
---
Director:
rules:
'dev': 'DevelopmentAdmin'
'sitemap.xml': 'GoogleSitemap'
'$Action' : 'BaseController'
@wilr
wilr / grunt.js
Created November 8, 2012 00:08
wcc/grunt.js
module.exports = function(grunt) {
grunt.initConfig({
lint: {
all: ['wcc/js/*.src.js']
},
meta: {
banner: '/*! DNA Designed Communications Limited | Copyright 2012 */'
},
less: {
development: {
@wilr
wilr / HTTPisBorkedTest.php
Created January 17, 2013 04:09
Example test to show urlRewriter is broken
<?php
class HTTPisBorkedTest extends SapphireTest {
public function testAbsoluteUrls() {
// should leave external urls along
$this->assertEquals('<a href="http://external.com">', HTTP::absoluteURLs('<a href="http://external.com">'));
}
}
@wilr
wilr / composer.rb
Created February 21, 2013 02:09
Composer helpers for using with Capistrano.
set :composer_bin, false
set :composer_options, "--no-scripts --verbose"
namespace :composer do
desc "Gets composer and installs it"
task :get, :roles => :app, :except => { :no_release => true } do
if remote_file_exists?("#{previous_release}/composer.phar")
pretty_print "--> Copying Composer from previous release"
run "#{try_sudo} sh -c 'cp #{previous_release}/composer.phar #{latest_release}/'"
puts_ok