Skip to content

Instantly share code, notes, and snippets.

gemcutter => redis downloads spec
=================================
keys
----
downloads => global counter for all gem downloads
downloads:today => sorted set for downloads from today
downloads:rubygem:rails => counter for all rails downloads
downloads:version:rails-2.3.5 => counter for all rails 2.3.5 downloads
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#
#
# textapp -- Combined SMS and IM dispatching
# Copyright 2009 Max Battcher. All Rights Reserved.
#
# Microsoft Public License (Ms-PL)
#
# This license governs use of the accompanying software. If you use the
# software, you accept this license. If you do not accept the license,
# do not use the software.
#
@rociiu
rociiu / ghi.rb
Created April 9, 2010 15:37 — forked from macournoyer/ghi.rb
#!/usr/bin/env ruby
require "rubygems"
require "mutter"
require "httparty"
REMOTE = "origin"
REPO = `git config --get remote.#{REMOTE}.url`.chomp[/github\.com[\/\:](\w+\/\w+)\.git/, 1]
USER = `git config --get github.user`.chomp
TOKEN = `git config --get github.token`.chomp
@rociiu
rociiu / app.yaml
Created April 11, 2010 08:00 — forked from Arachnid/app.yaml
application: filehangar
version: live
runtime: python
api_version: 1
handlers:
- url: /remote_api
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
login: admin
def hello():
print "hello"
def hello2():
print "hello2"
hello()
hello2()
class Dragon; end
# 使用 def 定義 class method
Dragon.instance_eval do
def foo
puts "bar"
end
end
Dragon.foo # bar
1: there is some hard code in the project like:
<% if false %>
Provided by <a href="http://recaptcha.net/" target="_blank">Recaptcha</a>
<% end %>
since the code wrap in the condition will never be execute, why not remove it .
2: maybe we can add fields into users for methods like "pending_count", so every time we load the information of user we don't need to join the friendships table.
3: we can move some big mail deliveries using background job (delayed_job etc.) , like InvitationMailer.deliver_invitations(@user, emails), since it will send couples of email out, it will lower the user experience to wait.
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Demo Everywhere</title>
</head>
<body>
<h1>hello world</h1>
<ul>
{% for msg in messages%}