Skip to content

Instantly share code, notes, and snippets.

View fatmatto's full-sized avatar
🎯
Focusing

Mattia Alfieri fatmatto

🎯
Focusing
View GitHub Profile
@fatmatto
fatmatto / gist:ec395133d8ad98280a39
Created July 17, 2015 09:17
Marketcloud GET /brands HAR
{
"method": "GET",
"url": "http://api.marketcloud.it/v0/brands",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{ "name": "X-Auth-Token", "value": "YOUR_TOKEN_HERE" }
],
"queryString" : []
}
@fatmatto
fatmatto / gist:3b2c51ea3ca28ea52d38
Created July 16, 2015 07:03
Marketcloud Get Products
{
"method": "GET",
"url": "http://api.marketcloud.it/v0/products/22",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{ "name": "Accept", "value": "application/json" },
{ "name": "Content-Type", "value": "application/json" },
{ "name": "X-Auth-Token", "value": "YOUR_TOKEN_HERE" }
],
@fatmatto
fatmatto / emitToSomeone.js
Last active December 10, 2015 04:08
How to emit to a specific user using socket.io and session.socket.io
//Usual express config
var SessionSockets = require('session.socket.io'),
sessionSockets = new SessionSockets(io, sessionStore, cookieParser); //sessionStore and cookieParser are from connect/express
sessionSockets.on("connection",function(err,socket,session) {
if (err)
console.log(err);
else {
console.log("Joining channel "+session.username);
socket.join(session.username); //This creates a socket.io room with a single socket.
@fatmatto
fatmatto / MultipleInheritantUsage.php
Created April 26, 2011 14:53
Pretending multiple inheritance in php5 Part2 Usage
<?php
class Pirate
{
public function doPirateStuff()
{
echo "YARRRRRRRR I SINK SHIPS!";
}
}
class Cyborg
@fatmatto
fatmatto / MultipleInheritant.php
Created April 26, 2011 14:52
Pretending multiple inheritance in php5
<?php
namespace qoo\core;
/**