Skip to content

Instantly share code, notes, and snippets.

@mathewpeterson
mathewpeterson / gitconfig
Created October 27, 2011 19:55
useful gitconfig settings
[alias]
update = !git fetch origin && git rebase origin/master
add-all = !git add -A && git status
done = !git fetch && git rebase origin/master && git checkout master && git merge @{-1} && git push
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
ir = !git rebase -i origin/master
unstage = reset HEAD
log-branch = log origin/master..
undo-commit = reset --soft HEAD^
branch-name = !git for-each-ref --format='%(refname:short)' `git symbolic-ref HEAD`
@mathewpeterson
mathewpeterson / .config
Created January 10, 2012 01:38
linux-3.0.4-xen config
#
# Automatically generated make config: don't edit
# Linux/x86_64 3.0.4 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
@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) {
@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) {