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
/* | |
The MIT License (MIT) | |
Copyright (c) 2014 Ismael Celis | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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
# Copyright 2010, Iain Hecker. All Rights Reserved | |
# Conway's Game of Life, in one line of Ruby. | |
# http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life | |
# Tested and found working on Ruby 1.8.7 and 1.9.2 | |
# The grid is spherical or "wrap around", so the left is connected to the right and top to bottom. | |
# | |
# Generate a random grid, 30 cells wide and 10 cells high | |
# | |
# grid = "30x10".to_grid | |
# |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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 'mongo' | |
module MongoPubSub | |
QUEUES_COLLECTION = 'queues' | |
class EndSubscriptionException < Exception; end | |
class Publisher | |
def initialize(queue_name, mongo_connection) | |
# Initialize queue collection as a capped collection | |
if not mongo_connection[QUEUES_COLLECTION].collection_names.include?(queue_name) |
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
BEGIN { | |
require 'net/http' | |
Net::HTTP.module_eval do | |
alias_method '__initialize__', 'initialize' | |
def initialize(*args,&block) | |
__initialize__(*args, &block) |
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
/** Class: Strophe.WebSocket | |
* XMPP Connection manager. | |
* | |
* Thie class is the main part of Strophe. It manages a BOSH connection | |
* to an XMPP server and dispatches events to the user callbacks as | |
* data arrives. It supports SASL PLAIN, SASL DIGEST-MD5, and legacy | |
* authentication. | |
* | |
* After creating a Strophe.Connection object, the user will typically | |
* call connect() with a user supplied callback to handle connection level |
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 'em-redis' | |
require 'redis' | |
require 'redis/distributed' | |
require "fiber_pool" | |
class Redis | |
class Distributed | |
def initialize(urls, options = {}) | |
@tag = options.delete(:tag) || /^\{(.+?)\}/ |
Install some needed libraries
brew install libmpc
Make the temp directory to build in
mkdir toolchain
cd toolchain
Get the required sources
OlderNewer