Skip to content

Instantly share code, notes, and snippets.

Avatar

Giovanni Aguirre giobyte8

View GitHub Profile
@giobyte8
giobyte8 / server-static-routing.js
Created Aug 16, 2015
Parte 4 | Creando un sistema de chat sobre NodeJS con Foundation
View server-static-routing.js
/** css and js static routes */
app.get('/css/foundation.min.css', function (req, res) {
res.sendFile(__dirname + '/views/css/foundation.min.css');
});
app.get('/css/normalize.css', function (req, res) {
res.sendFile(__dirname + '/views/css/normalize.css');
});
app.get('/css/chat.css', function (req, res) {
@giobyte8
giobyte8 / chat.css
Created Aug 16, 2015
Parte 4 | Creando un sistema de chat sobre NodeJS con Foundation
View chat.css
/**
* Chat SS Styles
*
* @author : DiganmeGiovanni | https://twitter.com/DiganmeGiovanni
* @Updated at: Aug 16, 2015;
*/
@import url(http://fonts.googleapis.com/css?family=Roboto:400,700);
@giobyte8
giobyte8 / chat.html
Last active Aug 29, 2015
Parte 4 | Creando un sistema de chat sobre NodeJS con Foundation Framework
View chat.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Chat room</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/foundation.min.css">
<link rel="stylesheet" href="css/chat.css">
@giobyte8
giobyte8 / vimrc
Last active Nov 12, 2016
My personal .vimrc
View vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
@giobyte8
giobyte8 / cmus-solmin
Created Apr 24, 2015
CMUS | Theme based on dark solarized
View cmus-solmin
# Giovanni Color Scheme for Cmus player ...
#
# This theme is designed to be 1) Very readable on high-resolution or blurry
# displays (dying CRTs and TVs, for example). 2) Be more accessable to color-
# blind people, by removing chroma cues in favor of brightness and color
# inversion. 3) Show how to incorperate named and numbered colors into a
# single theme. 4) Provide a stating point for creating other mono-chromatic
# themes.
#
# Questions, comments (just a heads-up that you use/like this, especially),
@giobyte8
giobyte8 / client.js
Last active Aug 29, 2015
Parte 3 | Creando un sistema de chat sobre NodeJS con Socket.IO, ExpressJS, MongoDB, Foundation y Openshift
View client.js
/** JSON Sobre el usuario conectado al sistema */
var user = {};
$(document).foundation();
$(document).ready(function () {
$('#login-modal').foundation('reveal', 'open');
});
/**
* Autentica a un usuario en el servidor mediante
@giobyte8
giobyte8 / chat.html
Created Apr 1, 2015
Parte 3 | Creando un sistema de chat sobre NodeJS con Socket.IO, ExpressJS, MongoDB, Foundation y Openshift
View chat.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Chat room</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/foundation.min.css">
</head>
<body>
@giobyte8
giobyte8 / client_f01.js
Created Apr 1, 2015
Parte 3 | Creando un sistema de chat sobre NodeJS con Socket.IO, ExpressJS, MongoDB, Foundation y Openshift
View client_f01.js
/**
* Emitimos un evento de tipo 'chat message' cada vez
* que se presiona 'Enter' en el textarea y enviamos
* su contenido como mensaje al servidor.
*/
$('#new-msg').keyup(function (evt) {
if (evt.keyCode === 13) {
var nmsg = {
username : user._id,
message : $('#new-msg').val()
@giobyte8
giobyte8 / client_f01.js
Created Apr 1, 2015
Parte 3 | Creando un sistema de chat sobre NodeJS con Socket.IO, ExpressJS, MongoDB, Foundation y Openshift
View client_f01.js
/**
* Agrega un mensaje a la lista de mensajes
* pertenecientes a la conversacióñ
*/
function appendMessage(msg) {
var humanDate = moment(new Date(msg.date)).calendar();
var html = '<div class="small-11">' +
'<blockquote><h6>' + msg.username + ':</h6>' +
msg.message +
'<cite>' + humanDate + '</cite></blockquote>' +
@giobyte8
giobyte8 / client_f01.js
Created Apr 1, 2015
Parte 3 | Creando un sistema de chat sobre NodeJS con Socket.IO, ExpressJS, MongoDB, Foundation y Openshift
View client_f01.js
/**
* Cuando el servidor envia los ultimos mensajes registrados
* se reciben a través de este evento.
* Cada mensaje se agrega a la lista de mensajes en la vista
* de la conversación.
*/
socket.on('latest messages', function (messages) {
for (var i = messages.length - 1; i >= 0; i--) {
appendMessage(messages[i]);
};