Skip to content

Instantly share code, notes, and snippets.

var util = {
list: function(variables, values, scope) {
for(var i = 0; i < variables.length && i < values.length; i++){
(scope || this)[variables[i]] = values[i];
}
}
};
@rich97
rich97 / game_node_server.js
Created July 19, 2011 13:04
Game node.js server for socket.io
// New connection
io.of('/game').sockets.on('connection', function(socket) {
// Login using the token sent to us from the client
socket.on('login', function(token) {
// New player requires a new player object
var player = new Player(token);
// We can only perform other options once the login has completed
player.login(function(player) {
// Remember the player on the socket
function getElementsByClassName(node,classname) {
if (node.getElementsByClassName) {
return node.getElementsByClassName(classname);
} else {
document.getElementsByClassName = function( className, nodeName ) {
var result = [], tag = nodeName||'*', node, seek, i;
if( document.evaluate ) {
seek = '//'+ tag +'[@class="'+ className +'"]';
seek = document.evaluate( seek, document, null, 0, null );
while((node = seek.iterateNext())) {
@rich97
rich97 / gist:1063377
Created July 4, 2011 14:14
Access control configuration.
<?php
use lithium\security\Auth;
use lithium\security\Password;
use li3_access\security\Access;
use li3_admin\models\Staffs;
Auth::config(array(
'root' => array(
'adapter' => 'Form', 'model' => 'Staffs', 'with' => 'Accounts',
Summary
Classes Covered 1
Executable Lines 41
Lines Covered 41
Lines Uncovered 0
Total Coverage 100%
Average Per Class 100%
<?php
// ...
class AuthRbacTest extends \lithium\test\Unit {
// ...
public function testParseMatch() {
$request = new Request(array('library' => 'test_library', 'controller' => 'test_controller', 'action' => 'test_action'));
<?php
/**
* li3_access plugin for Lithium: the most rad php framework.
*
* @author Tom Maiaroto
* @copyright Copyright 2010, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/
namespace li3_access\tests\cases\extensions\adapter\security\access;
-- phpMyAdmin SQL Dump
-- version 3.3.10
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 04, 2011 at 01:36 PM
-- Server version: 5.5.10
-- PHP Version: 5.3.6
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";