This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var enemyWallbot = false; | |
var Robot = function(robot) { | |
robot.clone() | |
if(robot.parentId==null){ | |
robot.turn(180); | |
robot.rotateCannon(180); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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 |