Skip to content

Instantly share code, notes, and snippets.

@cayasso
cayasso / weeklies.md
Last active July 21, 2019 13:36
List of Weeklies
@cayasso
cayasso / index.html
Created September 4, 2014 03:48
Socket.IO Simple Test
<!doctype>
<html>
<head>
<title>Chat</title>
</head>
<body>
<form id="formDatos">
<input type="text" id="dato" placeholder="Escriba el texto" required>
<input type="submit" value="enviar">
</form>
@cayasso
cayasso / index.html
Created August 6, 2014 23:50
Node JS API test
<!DOCTYPE>
<html>
<head>
</head>
<body>
<a id="eushell">EUSHELL</a>
<a id="cayasso">CAYASSO</a>

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

# References:
# http://blog.mixu.net/2011/08/13/nginx-websockets-ssl-and-socket-io-deployment/
# http://blog.exceliance.fr/2012/09/10/how-to-get-ssl-with-haproxy-getting-rid-of-stunnel-stud-nginx-or-pound/
#
global
nbproc 2
maxconn 16384
defaults
@cayasso
cayasso / custom-adapter-test.js
Created April 28, 2014 17:46
Custom primus-rooms-adapter
'use strict';
/**
* Module dependencies.
*/
var PilotAdapter('./custom-adapter')
, pilotsAdapter = new PilotsAdapter();
// primus-rooms call the set method
@cayasso
cayasso / index.html
Created March 12, 2014 16:32
Primus Quick Example
<!Doctype html>
<html>
<head>
<script src="/primus/primus.js"></script>
</head>
<body>
<script>
var primus = new Primus('ws://localhost:5000', { transformer: 'engine.io' });
@cayasso
cayasso / fail.html
Last active December 22, 2015 09:29
Socket.IO port issues, when connecting from domain with different port than 80 to a 80 port domain.
<!Doctype html>
<html lang="en">
<head>
</head>
<body>
<h1>Socket Test</h2>
<script src="http://localhost/socket.io/socket.io.js"></script>
@cayasso
cayasso / monitor.js
Created April 12, 2013 09:22
bid.io-monitor main file.
/**
* Monitor contstructor.
*
* @param {Object} io the SocketIO object
* @param {Object} bio BidIO object
* @param {Object} options monitor options
* @api public
*/
function Monitor (io, bio, options) {
@cayasso
cayasso / LeafletMap.js
Created October 31, 2012 17:15
Leaflet Map for enyo
enyo.kind({
name: "LeafletMap",
classes: "leaflet-map",
published: {
center: { lat: 33.7489, lng: -84.3881},
showMarker: true,
zoom: 17,
// point imagePath to your leaflet images folder
imagePath: "lib/extra/leaflet/images/",
cloudmadeApiKey: "",