Skip to content

Instantly share code, notes, and snippets.

@jaehess
jaehess / index.coffee
Created May 24, 2012 16:15 — forked from bryanhelmig/index.coffee
Simple Node.js Jabber/AIM REST API.
util = require "util"
xmpp = require "node-xmpp"
oscar = require 'oscar'
express = require "express"
###
The XMPP bot.
###

Recently, we've been working on extracting Ember conventions from applications we're working on into the framework. Our goal is to make it clearer how the parts of an Ember application work together, and how to organize and bootstrap your objects.

Routing

Routing is an important part of web applications. It allows your users to share the URL they see in their browser, and have the same things appear when their friends click on the link.

The Ember.js ecosystem has several great solutions for routing. But, since it is such an important part of most web applications, we've decided to build it right into the framework.

If you have already modeled your application state using Ember.StateManager, there are a few changes you'll need to make to enable routing. Once you've made those changes, you'll notice the browser's address bar spring to life as you start using your app—just by moving between states, Ember.js will update the URL automatically.

@jaehess
jaehess / 55.js
Created August 8, 2012 22:16 — forked from heapwolf/55.js
socket.io/server
var fs = require('fs');
var server = require('http').createServer(handler);
var io = require('socket.io').listen(server);
function handler (req, res) {
if (req.url === '/') {
res.statusCode = 200;
res.setHeader('content-type', 'text/html');
fs.createReadStream('./index.html').pipe(res);
}
@jaehess
jaehess / 56.html
Created August 8, 2012 22:16 — forked from heapwolf/56.html
socketio/client
<html>
<body>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<div id="inputs" style="font-size:60px">
<span>name: </span><input id="username" style="font-size:60px"></input>
</div>
<div id="chat" style="font-size:30"></div>
<script>
@jaehess
jaehess / chatServer.js
Created August 10, 2012 23:38 — forked from creationix/chatServer.js
A simple TCP based chat server written in node.js
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client
@jaehess
jaehess / easy_way.rb
Created September 2, 2012 14:45 — forked from mislav/easy_way.rb
RESOLVE SHORT URLS before storing. Short URLs are for microblogging; you should never actually keep them around.
require 'net/http'
# WARNING do not use this; it works but is very limited
def resolve url
res = Net::HTTP.get_response URI(url)
if res.code == '301' then res['location']
else url.to_s
end
end
@jaehess
jaehess / cleanup.rb
Created October 12, 2012 16:40 — forked from MoriTanosuke/cleanup.rb
Delete all your tweets from Twitter with Ruby
require 'twitter'
require 'peach'
USERNAME = '' # put your twitter username here
Twitter.configure do |config|
config.consumer_key = YOUR_CONSUMER_KEY
config.consumer_secret = YOUR_CONSUMER_SECRET
config.oauth_token = YOUR_OAUTH_TOKEN
config.oauth_token_secret = YOUR_OAUTH_SECRET
@jaehess
jaehess / .gitconfig
Created October 24, 2012 13:51 — forked from macournoyer/.gitconfig
Git shortcuts
[alias]
st = status
s = status
co = checkout
ci = commit -a -v
b = branch
d = diff
p = pull
a = add .
l = log
SC.Binding.lt = function (max) {
return this.transform(function (value, binding) {
return SC.typeOf(value) === SC.T_NUMBER && value < max;
});
};
SC.Binding.gt = function (min) {
return this.transform(function (value, binding) {
return SC.typeOf(value) === SC.T_NUMBER && value > min;
});
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>