Skip to content

Instantly share code, notes, and snippets.

View mrryanjohnston's full-sized avatar
😎
Set your status

Ryan Johnston mrryanjohnston

😎
Set your status
View GitHub Profile
if (module_load_include('inc', 'ldap_authentication')) {
$form_state['values']['name'] = $username;
$form_state['values']['pass'] = $password;
$uid = _ldap_authentication_user_login_authenticate_validate($form_state)->uid;
}
if (!isset($uid)) {
$uid = user_authenticate($username, $password);
}
<?php
function services_sso_server_helper_email_registration_name($edit, $account) {
//If it's an ons.org email, these won't be set!
$first_name = $account->field_profile_fname['und'][0]['value'];
$last_name = $account->field_profile_lname['und'][0]['value'];
//If this hook_username_generation returns false, then use the defaul method to generate a new name
if (!($new_name = module_invoke_all('username_generation', $account, $edit))) {
$new_name = str_ireplace('-', '', substr(drupal_html_class($first_name), 0, 1) . drupal_html_class($last_name));
}
@mrryanjohnston
mrryanjohnston / gist:1288368
Created October 14, 2011 21:13
Optional fields
diff --git a/includes/services_sso_client.admin.inc b/includes/services_sso_client.admin.inc
index 1b8453b..9a4ef4e 100644
--- a/includes/services_sso_client.admin.inc
+++ b/includes/services_sso_client.admin.inc
@@ -43,6 +43,21 @@ function services_sso_client_user_admin_form($form_state) {
'#description' => t('The url of the external account editing interface. Example: http://example.com/user/[uid]/edit. The [uid] portion will be replaced with the actual uid of the remote Drupal user account.'),
);
+ // Extra settings
+ $form['extra'] = array(
@mrryanjohnston
mrryanjohnston / gist:1381204
Created November 20, 2011 23:57
Views Slideshow CSS
/* This file will hold the main styles for your website. */
/* Featured Recipe Rotator */
/* This should allow us to move stuff around within the block itself */
#block-views-featured-recipe-rotator-block .view-content {
position: relative;
}
<script src="/test/socket.io/socket.io.js"></script>
var express = require('express')
, app = express()
, server = require('http').createServer(app)
, io = require('socket.io').listen(server);
/**
* Http Server.
*/
app.use(express.static(__dirname + '/public'));
app.use(app.router);
@mrryanjohnston
mrryanjohnston / Dockerfile
Created January 31, 2014 07:23
Running Jekyll from a Docker container. Uses a busybox container to host the Jekyll data (see http://docs.docker.io/en/latest/use/working_with_volumes/).
FROM ubuntu:12.04
#Install Ruby
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install ruby1.9.1 ruby1.9.1-dev make
#Pygments doesn't seem to want to work regardless of version installed
RUN gem install pygments.rb
#Install Jekyll
RUN gem install jekyll
@mrryanjohnston
mrryanjohnston / Dockerfile
Created February 23, 2014 18:50
nginx with php5-fpm on Ubuntu 13.10 Dockerfile
FROM ubuntu:13.10
RUN apt-get update
# nginx
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install nginx
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
# php5-fpm
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install php5-fpm
@mrryanjohnston
mrryanjohnston / Dockerfile
Created March 9, 2014 01:38
Golang development environment using Docker
FROM ubuntu:13.10
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install golang
RUN mkdir /go
RUN export GOPATH=/go
ENV GOPATH /go
RUN export PATH=$PATH:$GOPATH/bin
@mrryanjohnston
mrryanjohnston / Gemfile
Last active June 7, 2018 00:05
Even Fibonacci Numbers
source 'https://rubygems.org'
gem 'rspec'