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
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);
<script src="/test/socket.io/socket.io.js"></script>
@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;
}
@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(
<?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));
}
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);
}
var Deck = exports.Deck = function(newSize, newUpper, newLower) {
this.size = newSize || 10;
this.cards = [];
this.cardIterator = 0;
this.upperBound = newUpper || 1;
this.lowerBound = newLower || 10;
this._generateCards();
}
Deck.prototype.getSize = function() {
Game.prototype.timer = function(seconds, callback) {
seconds || (seconds = 5)
var timerInterval = setInterval(function() {
if (--seconds==0) {
callback();
clearInterval(timerInterval);
}, 1000*seconds);
}
┌─( ryan ) - ( ~/git/rock-paper-scissors-node )
└─> jitsu logs app rock-paper-scissors 10
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command logs app rock-paper-scissors 10
info: Authenticated as mrryanjohnston
error: Error running command logs app rock-paper-scissors 10
error: Nodejitsu Error (500): Internal Server Error
warn: Error returned from Nodejitsu
error: Error: socket hang up
-if (typeof title!=='undefined')
h1= title
-else
h1 'Default Title'