Skip to content

Instantly share code, notes, and snippets.

View ssoper's full-sized avatar
👨‍💻

Sean Soper ssoper

👨‍💻
View GitHub Profile
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@tomshaw
tomshaw / app.js
Created August 6, 2011 02:53
A nodemailer wrapper library that makes it easy to send emails using Express and Jade templates.
/*!
* MailWrapper - An extremely simple nodemailer wrapper library that makes it easy to send emails using Express and Jade templates. Originally
* developed to practice and learn how to write modules for node.
*
* Copyright(c) 2011 Tom Shaw <[email protected]>
* MIT Licensed
*/
var mailer = require('./lib/mailer');
@quezo
quezo / index.haml
Created August 31, 2012 06:38
I wanted to make a simple Mac OS X window in CSS. A window itself is kind of boring so I decided to make it a nonfunctional code editor. Written in SASS with Compass and HAML. Even though the design is very simple and generic, I guess Sublime Text 2 and
#app
#toolbar
#traffic-light
.aqua#red
.aqua#yellow
.aqua#green
#view
#tree
%ul
%li index.haml
@branneman
branneman / better-nodejs-require-paths.md
Last active October 18, 2024 20:29
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@MikeyBurkman
MikeyBurkman / baz.ts
Last active January 2, 2019 22:27
TS Dependency Example
/**
* Dependency Example in TS.
* Instead of dependency injection, this method shows how services can "fetch" their dependencies,
* without being concerned about the lifecycles of their dependencies.
* These services are also isolated from their dependencies, lending themselves to easier testing.
* Does not use classes or decorators or any black magic to accomplish this.
*
* All services are essentially split into 3 pieces:
* 1. The interface that defines the service to other services.
* 2. The service constructing function that takes in all depedencies as arguments.