Skip to content

Instantly share code, notes, and snippets.

Avatar

Mohamed Ahmed mohamed-ahmed

  • Ottawa, Canada
View GitHub Profile
@mohamed-ahmed
mohamed-ahmed / static_server.js
Last active Aug 29, 2015
Small block of code to serve static files using node (useful for debugging when "XMLHttpRequest cannot load file..")
View static_server.js
var express = require('express');
var app = express();
var path = require('path');
app.get('/', function(req, res) {
res.sendfile('index.html');
});
app.use(express.static(path.join(__dirname, '/')));
@mohamed-ahmed
mohamed-ahmed / get_usb_ip_address.sh
Created Jun 16, 2014
Get ip address of usb0 device (Linux)
View get_usb_ip_address.sh
ifconfig | grep usb -1 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
View application.js
var q= function(s){ return document.getElementById(s) }
function send(){
var input = q('text');
socket.send(input.value);
input.value = '';
}
var socket = new io.Socket(null, {
port: 8001,
View Custom sublime-text key bindings (Windows)
//windows
[
//ctrl+i to indent lines properly like in eclipse (Windows)
{ "keys": ["ctrl+i"], "command": "reindent" }
]
//macosx
[
//ctrl+i to indent lines properly like in eclipse (Mac OSX)
{ "keys": ["super+i"], "command": "reindent" }
You can’t perform that action at this time.