Skip to content

Instantly share code, notes, and snippets.

View slickplaid's full-sized avatar

Evan slickplaid

View GitHub Profile
(function($){
$.fn.extend({
buildMenu: function(options) {
var defaults = {
limit: 3,
moreText: "More",
lessText: "Less",
numbers: true,
append: true,
@slickplaid
slickplaid / nodemon.error
Created February 21, 2011 19:35
nodemon@0.2.0 with node.js@0.4.1 error
$ nodemon
/home/slickplaid/.nvm/v0.4.1/bin/nodemon: line 1: syntax error near unexpected token `('
/home/slickplaid/.nvm/v0.4.1/bin/nodemon: line 1: `var fs = require('fs'),'
@slickplaid
slickplaid / html5video.html
Created May 12, 2011 22:28 — forked from beastaugh/html5video.html
HTML5 video, falling back to Flowplayer
<div id="video-1-container" class="video">
<video id="video-1" src="video/html5.mp4" width="480" height="204" controls>
<!-- HTML5 video, for compatible browsers -->
</video>
</div>
<script type="text/javascript">
Ojay.onDOMReady(function() {
// The video and the container need separate IDs to work around IE6's
// unwillingness to locate video elements.
@slickplaid
slickplaid / index.html
Created May 27, 2011 23:20
Simple example
<!-- put me in public/index.html -->
<!doctype html>
<html>
<head><title>Testing Express, Socket.io in Node.js</title></head>
<body>
<h1>Test!</h1>
<div class="m"></div>
<button>Send Message</button>
<!-- CHANGE to server hostname:port/socket.io/socket.io.js -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
module.exports.doSomething = function(redis){
redis.doSomethingWithRedis;
}
@slickplaid
slickplaid / config.json
Created June 3, 2011 23:11
Kohai Error
{
"config": {
"version": "v0.0.6",
"nick": "twitter",
"server": "irc.myserver.com",
"channels": [
"#twitter"
],
"plugins": {
"twitter": {
// core
var test = require('test');
test.bob();
// test file
var bob = require('bob');
var test = { bob: bob }
module.exports = test;
// bob file
@slickplaid
slickplaid / round-robin-proxy.js
Created June 9, 2011 23:38 — forked from indexzero/round-robin-proxy.js
A simple example of how to do round-robin proxying for a single domain
var httpProxy = require('http-proxy');
//
// Addresses to use in the round robin proxy
//
var addresses = [
{
host: 'ws1.0.0.0',
port: 80
},
$ git fetch https://github.com/bnoguchi/everyauth.git
$ git fetch https://github.com/bnoguchi/everyauth.git master
From https://github.com/bnoguchi/everyauth
* branch master -> FETCH_HEAD
$ git status
# On branch master
nothing to commit (working directory clean)
@slickplaid
slickplaid / memUsage.js
Created August 19, 2011 21:51
Testing Memory Usage
// testing memory usage
function readableBytes(bytes){
var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'];
var e = Math.floor(Math.log(bytes)/Math.log(1024));
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+' '+s[e];
}
function memUsage(){
var mem = process.memoryUsage();
var rss = readableBytes(mem.rss);
var vsize = readableBytes(mem.vsize);