Skip to content

Instantly share code, notes, and snippets.

View giobyte8's full-sized avatar

Giovanni Aguirre giobyte8

View GitHub Profile
@giobyte8
giobyte8 / server-static-routing.js
Created August 16, 2015 06:11
Parte 4 | Creando un sistema de chat sobre NodeJS con Foundation
/** 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 August 16, 2015 06:05
Parte 4 | Creando un sistema de chat sobre NodeJS con Foundation
/**
* 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 August 29, 2015 14:27
Parte 4 | Creando un sistema de chat sobre NodeJS con Foundation Framework
<!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 November 12, 2016 06:52
My personal .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 April 24, 2015 07:22
CMUS | Theme based on dark solarized
# 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 August 29, 2015 14:18
Parte 3 | Creando un sistema de chat sobre NodeJS con Socket.IO, ExpressJS, MongoDB, Foundation y Openshift
/** 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 April 1, 2015 03:41
Parte 3 | Creando un sistema de chat sobre NodeJS con Socket.IO, ExpressJS, MongoDB, Foundation y Openshift
<!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 April 1, 2015 03:36
Parte 3 | Creando un sistema de chat sobre NodeJS con Socket.IO, ExpressJS, MongoDB, Foundation y Openshift
/**
* 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 April 1, 2015 03:31
Parte 3 | Creando un sistema de chat sobre NodeJS con Socket.IO, ExpressJS, MongoDB, Foundation y Openshift
/**
* 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 April 1, 2015 03:30
Parte 3 | Creando un sistema de chat sobre NodeJS con Socket.IO, ExpressJS, MongoDB, Foundation y Openshift
/**
* 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]);
};