I hereby claim:
- I am mironov on github.
- I am mironov (https://keybase.io/mironov) on keybase.
- I have a public key ASBsVT8HY90eEjGcqm8e8fMxCLHyN9Pk5zT9PhkD_BldJQo
To claim this, I am signing this object:
obkfjhifkbhimlocpddgamonjihinpak |
I hereby claim:
To claim this, I am signing this object:
require "json" | |
require "csv" | |
json = File.read("qa.json") | |
parsed_json = JSON.parse(json) | |
lists = {} | |
parsed_json["lists"].each do |list| | |
lists[list["id"]] = list["name"] | |
end |
module DBI | |
class Row | |
# | |
# See Object#clone. | |
# | |
# #clone here, however, is a deep copy via Marshal. | |
# | |
def clone | |
Marshal.load(Marshal.dump(self)) | |
end |
module Rack | |
class Request | |
def scheme | |
if @env['HTTPS'] == 'on' | |
'https' | |
elsif @env['HTTP_X_FORWARDED_SSL'] == 'on' | |
'https' | |
elsif @env['HTTP_X_FORWARDED_PROTO'] | |
@env['HTTP_X_FORWARDED_PROTO'].split(',')[0] | |
else |
<message type='chat' id='purple3475c67' to='[email protected]'> | |
<active xmlns='http://jabber.org/protocol/chatstates'/> | |
<body>link text <http://google.com?a=1&amp;b=2></body> | |
<html xmlns='http://jabber.org/protocol/xhtml-im'> | |
<body xmlns='http://www.w3.org/1999/xhtml'><p><a href='http://google.com?a=1&amp;b=2'>link text</a></p></body> | |
</html> | |
</message> |
<message type='chat' id='purple3475c67' to='[email protected]'> | |
<active xmlns='http://jabber.org/protocol/chatstates'/> | |
<body>link text <http://google.com?a=1&amp;b=2></body> | |
<html xmlns='http://jabber.org/protocol/xhtml-im'> | |
<body xmlns='http://www.w3.org/1999/xhtml'><p><a href='http://google.com?a=1&b=2'>link text</a></p></body> | |
</html> | |
</message> |
require 'rubygems' | |
require 'eventmachine' | |
require 'em-websocket' | |
require 'json' | |
class Connection | |
attr_accessor :socket, :user_id | |
def initialize(socket, user_id) | |
@socket = socket |
class User < ActiveRecord::Base | |
# gradual engagement is needed, to allow admin creation of users | |
# users should create authorization data only when they need to | |
# access some system feature that requires authentication | |
# So ... our gradual engagement scheme for authlogic: | |
# 1. admin creates user, setting only name and phone number (required) | |
# admin may set email address (optional) | |
# 2. user is sent email invitation with link to activate their account | |
# admin can re-send email at user's request | |
# 3. user sets login and password/password_confirmation using activation form |
span_trans = lambda do |el| | |
if el[:node].name == "span" | |
if el[:node].has_attribute?("style") | |
rules = el[:node].attribute("style").value.split(";") | |
new_rules = rules.map do |rule| | |
rule.match(/text-decoration:\s*(underline|overline|line-through)\b/) || | |
rule.match(/font-weight:\s*bold\b/) || | |
rule.match(/font-style:\s*italic\b/) | |
end | |
new_style = new_rules.compact.map{|r| r.to_s}.join("; ") |