Skip to content

Instantly share code, notes, and snippets.

View alejandro's full-sized avatar

Alejandro Morales alejandro

  • Revls
  • Tegucigalpa, Honduras
View GitHub Profile
@alejandro
alejandro / ajaxify-html5.js
Created September 21, 2011 01:13 — forked from balupton/README.md
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
// https://gist.github.com/854622
(function(window,undefined){
// Prepare our Variables
var
History = window.History,
$ = window.jQuery,
document = window.document;
// Check to see if History.js is enabled for our Browser
@alejandro
alejandro / command.sh
Created October 29, 2011 22:27 — forked from felixge/command.sh
Bash stuff for fighting a weak DOS attack
# Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference.
# The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2
# Step 0: Check what is going on at port 80
$ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c
# Step 1: Increase the number of available fds
$ ulimit -n 32000
# Step 2: Restart your webserver, for me:
@alejandro
alejandro / error
Created November 8, 2011 04:28 — forked from RexMorgan/error
› node server.js
The "sys" module is now called "util". It should have a similar interface.
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: object is not a function
at EventEmitter.CALL_NON_FUNCTION (native)
at Object.<anonymous> (/home/rex/Projects/foilr/lib/server.js:10:3)
at Object.<anonymous> (/home/rex/Projects/foilr/lib/server.js:11:4)
@alejandro
alejandro / inherits.js
Created November 9, 2011 04:36 — forked from jfhbrook/inherits.js
Am I the only one that finds this more readable?
var util = require("util");
var inherits = function (inherits, fn) {
util.inherits(fn, inherits);
return fn;
}
@alejandro
alejandro / gist:1374191
Created November 17, 2011 19:31 — forked from JeffreyWay/gist:1374162
Prompt IE6 for Chrome Frame Install
<!--[if lt IE 7 ]>
<script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<script>CFInstall.check();</script>
<![endif]-->
@alejandro
alejandro / readme-outline.md
Created November 20, 2011 05:44 — forked from indexzero/readme-outline.md
A quick outline of a README.md

README.md Outline

  • Header and a Brief description (should match package.json)
  • Example (if applicable)
  • Motivation (if applicable)
  • API Documentation: This will likely vary considerably from library to library.
  • Installation
  • Tests
  • Contributors
  • License
@alejandro
alejandro / app.js
Created December 16, 2011 23:58 — forked from betobaz/app.js
node.js Upload file formidable
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, stylus = require('stylus')
, util = require('util')
//, form = require('connect-form')
var events = require('events');
var util = require('util');
var http = require('http');
var options = {
hostname : 'api.twitter.com',
port : 80,
method : 'get',
path : '/1/statuses/public_timeline.json?count=3&include_entities=true'
@alejandro
alejandro / dabblet.css
Created June 3, 2012 02:34 — forked from anonymous/dabblet.css
Untitled
body {
background:#eee;
}
#w {
height:1500px;
width:100%;
right:10px;
background:#eee;
}
::-webkit-scrollbar {height: 16px;overflow: visible;width:26px;}
@alejandro
alejandro / server.js
Created June 26, 2012 00:34 — forked from anonymous/server.js
mookmike sockets
//Dependencies
var http = require('http')
, express = require('express')
, stylus = require('stylus')
, nib = require('nib')
, app = express()
;