Skip to content

Instantly share code, notes, and snippets.

@aymerick
aymerick / gitconfig-git
Created May 2, 2018 14:35 — forked from stevenh512/gitconfig-git
URL rewriting in .gitconfig
# Use git and git+ssh instead of https
[url "git://github.com/"]
insteadOf = https://github.com/
[url "git@github.com:"]
pushInsteadOf = "git://github.com/"
[url "git@github.com:"]
pushInsteadOf = "https://github.com/"
# simple Socket API
module EventMachine
class Socket
class Client < EM::Connection
def initialize socket
@socket = socket
end
attr_accessor :socket
##
# sync api: return values and exceptions
begin
images = []
results = RestClient.get('http://google.com/search?q=ruby')
Hpricot(results).find('a').each{ |link|
page = RestClient.get(link)
begin
if __FILE__ == $0
require 'em/spec'
class TestConnection
include EM::P::Memcache
def send_data data
sent_data << data
end
def sent_data
@sent_data ||= ''
require 'rubygems'
require 'eventmachine'
### EM::run takes over the process
# puts 1
# EM.run{
# require 'mycode'
# }
# puts 3 # this will never happen
# async_sinatra_example.ru
require 'sinatra'
# Normally Sinatra::Base expects that the completion of a request is
# determined by the block exiting, and returning a value for the body.
#
# In an async environment, we want to tell the webserver that we're not going
# to provide a response now, but some time in the future.
#
# The a* methods provide a method for doing this, by informing the server of