Skip to content

Instantly share code, notes, and snippets.

@mathewpeterson
mathewpeterson / fubot-init.sh
Created February 12, 2012 01:51 — forked from philchristensen/fubot-init.sh
hubot init script
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/fubot/bin/hubot
NAME=fubot
DESC="Jabber Bot"
CONF="-a xmpp --name $NAME"
BOT_USER=fubot
BOT_GROUP=fubot
@mathewpeterson
mathewpeterson / hack.sh
Created March 31, 2012 12:13 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
http://search.cpan.org/~ribasushi/SQL-Translator-0.11005/script/sqlt-diff
#!/usr/bin/perl
$REGEXP = shift || die "no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!";
@data = qx</usr/sbin/postqueue -p>;
for (@data) {
if (/^(\w+)(\*|\!)?\s/) {
$queue_id = $1;
}
if($queue_id) {
#!/usr/bin/perl -w
# 2/2000 krischan at jodies.cx
#
# 0.14 Release
# 0.14.1 Allow netmasks given as dotted quads
# 0.15 Colorize Classbits, Mark new bits in network
# 0.16 25.9.2000 Accept <addr>/<cidr> as first argument
# Print <pre> tag in the script
# 0.17 Bugfix
@mathewpeterson
mathewpeterson / ip_range.php
Created April 5, 2012 16:06
This will generate an array of ip address
<?php
function ip_range($from, $to) {
$start = ip2long($from);
$end = ip2long($to);
$range = range($start, $end);
return array_map('long2ip', $range);
}
<?php
class MY_Controller extends CI_Controller
{
/**
* Takes the method passed to it for the router
* and loads a header and footer for all controller methods
* automatically setting an id and class for CSS Scoping
*
* @param string $method

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
function make_comparer() {
// Normalize criteria up front so that the comparer finds everything tidy
$criteria = func_get_args();
foreach ($criteria as $index => $criterion) {
$criteria[$index] = is_array($criterion)
? array_pad($criterion, 3, null)
: array($criterion, SORT_ASC, null);
}
return function($first, $second) use (&$criteria) {