Skip to content

Instantly share code, notes, and snippets.

Working from home

Tiago A. tiagoa

Working from home
  • wBuy
  • Maringá
View GitHub Profile
View gist:4039763
var http = require('http');
var qtd = process.argv[2] || 1;
for (var i = 0; i < qtd; i++) {
http.get({host:'', port:80, path:'/', agent:false}, function(res){
res.on('data', function(d){
}).on('end', function(){
console.log('respondeu ao cliente #'+i);
tiagoa / CakePHP access control
Created Oct 20, 2012
A CakePHP access control implementation with a User hasMany Role schema
View CakePHP access control
class AppController extends Controller {
public $permissions = array(
'Admin' => '*',
array('controller'=>'pages', 'action'=>'display'),
array('controller'=>'books', 'action'=>'*')
tiagoa / Backbone.websocket.js
Created Oct 13, 2012
Overwrite Backbone.sync method to persist model via WebSocket
View Backbone.websocket.js
// Inspired by
// Overwrite Backbone.sync method
Backbone.sync = function(method, model, options){
// create a connection to the server
var ws = new WebSocket('ws://');
// send the command in url only if the connection is opened
// command attribute is used in server-side.
ws.onopen = function(){