Skip to content

Instantly share code, notes, and snippets.

View MauMaGau's full-sized avatar

Dave Townsend MauMaGau

View GitHub Profile
@MauMaGau
MauMaGau / gist:5034237
Created February 25, 2013 23:15
Ratchet - Introduction
<div class="legible-width">
<p><a href="http://socketo.me/">Ratchet</a> is a websocket server written in php. It's a platform that enables the server and the client to communicate freely. Unlike with regular http, which relies on the client asking for information and the server replying, ws (the websocket protocol) allows the server to start a two-way conversation. The best example is a chat server:</p>
<ol>
<li>Jack & Jill visit your chat page from seperate computers</li>
<li>Jack enters "hello" in to a form and clicks the submit button</li>
<li>The server receives the request, and notifies Jill's computer</li>
<li>Jill's computer receives Jack's salutation from the server, and a fairy tale begins...</li>
</ol>
<p>Websockets take care of the third part of that interaction; something we haven't been able to do in regular web programming before.</p>
<p><i>It's hard to overstate how important websockets are. They will revolutionise the way we write web apps.</i></p>
@MauMaGau
MauMaGau / robot.js
Created December 5, 2012 19:39
Baleted
var Robot = function(robot){
robot.turnLeft(robot.angle % 90);
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
if (robot.parentId) {
robot.ahead(1);
robot.turnGunRight(1);
}
else {
@MauMaGau
MauMaGau / robot.js
Created December 5, 2012 19:37 — forked from Shipow/robot.js
Application Error
var enemyWallbot = false;
var Robot = function(robot) {
robot.clone()
if(robot.parentId==null){
robot.turn(180);
robot.rotateCannon(180);
}
};
@MauMaGau
MauMaGau / gist:4208827
Created December 4, 2012 21:22 — forked from randompast/robot.js
QR-bot-009
We couldn’t find that file to show.
@MauMaGau
MauMaGau / robot.js
Created December 4, 2012 20:09 — forked from cgardner/robot.js
MauMaGau Return of the Mau
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
robot.clone();
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
if(robot.parentId) {
@MauMaGau
MauMaGau / robot.js
Created December 4, 2012 16:16 — forked from folkien/robot.js
Maumagau strikes again
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
//robot.clone();
enemyWallbot = false;
onWall = false
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
@MauMaGau
MauMaGau / robot.js
Created December 4, 2012 14:44
MauMaGau
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(50);
@MauMaGau
MauMaGau / CI: MY_Upload
Created November 27, 2012 13:31
Codeigniter allow file types except...
<?php if( ! defined('BASEPATH') ) exit('No direct script access allowed');
/*
If we allow all file type, allow for exclusions as well
*/
class MY_Upload Extends CI_Upload{
public function set_allowed_types($types)
{
$this->allowed_types = explode('|', $types);
@MauMaGau
MauMaGau / gist:2881941
Created June 6, 2012 13:46
JS/JQUERY: multi-input
<script>
// Multi-input
$('.input-multi-add').click(function(){
var list = $(this).siblings('.input-multi');
var template = list.find('.template');
list.append(template
.clone()
.removeClass('template hidden')
.removeAttr('disabled')
.after("<a class="multi-input-remove">Remove</a>")
@MauMaGau
MauMaGau / gist:2839136
Created May 30, 2012 21:43
HTML/CSS/JQUERY: Nice styling
<!-- Le html -->
<form class='form form-horizontal' action='' method=''>
<!-- declaring a class of form looks odd, but it leaves me the option
of having non-standard forms without having to overwrite standard form css -->
<!-- Inputs and labels are grouped in fieldsets. This makes it much easier to
arrange them with css -->
<fieldset>
<label class='label placeholder'>First name</label><!-- This label serves as