This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'eventmachine' | |
module ChatClient | |
def self.list | |
@list ||= [] | |
end | |
def post_init | |
@name = "anonymous_#{rand(99999)}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'dbus' | |
MYNAME = 'com.example.skype_api_client' | |
class SkypeAPI | |
def initialize(name = MYNAME) | |
bus = DBus.session_bus | |
service = bus.service("com.Skype.API") | |
objs = service.object("/com/Skype") | |
objs.introspect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RedisSessionStore.logger = Rails.logger | |
session_options = {:expire_after => 1.day, :key_prefix => 'sessions'} | |
MultiSessionStore.stores[:plain] = [RedisSessionStore, session_options.merge(:key => '_session_id')] | |
MultiSessionStore.stores[:secure] = [RedisSessionStore, session_options.merge(:key => '_secure_session_id', :secure => ['production', 'staging'].include?(Rails.env))] | |
MultiSessionStore.default_store = :plain | |
MultiSessionStore.routes = [ | |
['/admin', :secure], | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A sample Gemfile | |
source "http://rubygems.org" | |
gem "redis" | |
gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git' | |
gem "em-hiredis" | |
# gem "em-synchrony" | |
gem "em-websocket" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'redis/connection/synchrony' | |
require 'redis/connection/hiredis' | |
require 'redis' | |
redis = EventMachine::Synchrony::ConnectionPool.new(size: 1) do | |
Redis.new(:password => 'my password', | |
:host => 'my host', | |
:port => my port) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'em-http-request' | |
# Monkey-patched Gzip Decoder to handle | |
# Gzip streams. | |
# | |
# This takes advantage of the fact that | |
# Zlib::GzipReader takes an IO object & | |
# reads from it as it decompresses. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id='tag_cloud'> | |
{% for tag in site.tags %} | |
<a href="#{{ tag[0] }}" title="{{ tag[0] }}" rel="{{ tag[1].size }}">{{ tag[0] }}</a> | |
{% endfor %} | |
</div> | |
<ul id='tag_list'> | |
{% for tag in site.tags %} | |
<li class='tag_item' id='{{ tag[0] }}'> | |
<span class='tag_name'>{{ tag[0] }}</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: god | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: God |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* if portrait mode is detected, rotate the entire site -90 degrees to hint rotating to landscape */ | |
@media (orientation: portrait) { | |
body { | |
-webkit-transform: rotate(-90deg); | |
-moz-transform: rotate(-90deg); | |
-o-transform: rotate(-90deg); | |
-ms-transform: rotate(-90deg); | |
transform: rotate(-90deg); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb) | |
namespace :deploy do | |
namespace :assets do | |
desc <<-DESC | |
Run the asset precompilation rake task. You can specify the full path \ | |
to the rake executable by setting the rake variable. You can also \ |
OlderNewer