(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
# 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 |
var YUI_config = { | |
injected: true, | |
comboBase: '../scripts/combo?', | |
root: '/yui/', | |
// if combine is false | |
base: '../scripts/public/yui/', | |
// where to add the scripts | |
insertBefore: "favicon", | |
groups: { | |
<!-- layout file --> | |
<% if current_user %> | |
Welcome <%= current_user.username %>. Not you? <%= link_to "Log out", logout_path %> | |
<% else %> | |
<%= link_to "Sign up", signup_path %> or <%= link_to "log in", login_path %>. | |
<% end %> |
#!/usr/bin/env ruby | |
# List all keys stored in memcache. | |
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
require 'net/telnet' | |
headings = %w(id expires bytes cache_key) | |
rows = [] |
mr Marathi | |
bs Bosnian | |
ee_TG Ewe (Togo) | |
ms Malay | |
kam_KE Kamba (Kenya) | |
mt Maltese | |
ha Hausa | |
es_HN Spanish (Honduras) | |
ml_IN Malayalam (India) | |
ro_MD Romanian (Moldova) |
function Debug(){// prevents console.logs from ending up in the code when debugging, YAY! | |
var typeLog = typeof(typeLog) != 'undefined' ? typeLog : "log"; | |
//allows for an optional hrd coded caller argument | |
var caller = typeof(caller) != 'undefined' ? caller : this.caller; | |
this.debugMode = false; | |
function enable(value){ | |
this.debugMode = value; | |
return this.debugMode; | |
}; | |
function alertThis(massage,typeLog,caller){ |
import redis | |
import threading | |
class Listener(threading.Thread): | |
def __init__(self, r, channels): | |
threading.Thread.__init__(self) | |
self.redis = r | |
self.pubsub = self.redis.pubsub() | |
self.pubsub.subscribe(channels) | |
#!/usr/bin/env ruby | |
require 'net/telnet' | |
require 'lib/trollop' | |
opts = Trollop::options do | |
banner <<-EOS | |
Command line tool to list memcache keys and to get the value of a specific key | |
Usage: | |
memcache [options] |
// Tail node log | |
bdalziel@dev02:~$ sudo su | |
[sudo] password for bdalziel: | |
root@dev02:/home/bdalziel# tail -f /var/log/node/less.log | |
.. log ... | |
// Kill & restart process in background |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.