Skip to content

Instantly share code, notes, and snippets.

!.*/(\.[^/]*|tmp|documents|index|public/images|vendor/rails|vendor/.*/test|vendor/.*/tests|doc|rails_root|CVS|log|data_dump|build|_darcs|pkg |_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)? |bundle))$
calendar({:year => Date.today.year, :month => Date.today.month, :first_day_of_week => 1}) do |d|
cell_text = "#{d.mday}<br />"
cell_attrs = {:class => 'day'}
@incompleted_tasks.each do |task|
if task.deadline == d
cell_text << link_to(task.name, project_task_path(@project.id, task.id)) << "<br />"
if task.deadline < Date.today
cell_attrs[:class] = 'specialDayLated'
else
cell_attrs[:class] = 'specialDay'
MemCheck: -1068 [173680-174748]: Exchange#index (pid=25657)
MemCheck: -1068 [173680-174748]: Exchange#index (pid=26142)
MemCheck: 0 [175772-175772]: Exchange#index (pid=26142)
MemCheck: 0 [175772-175772]: Exchange#index (pid=26142)
MemCheck: -68 [175772-175840]: Exchange#create (pid=26142)
MemCheck: 0 [175840-175840]: Exchange#index (pid=26142)
MemCheck: 0 [175840-175840]: SupplierProducts#set_new_prices (pid=26142)
MemCheck: -1068 [173680-174748]: Exchange#index (pid=27224)
MemCheck: 0 [175772-175772]: Exchange#index (pid=27224)
MemCheck: -68 [175772-175840]: Exchange#create (pid=27224)
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("; ")
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
require 'rubygems'
require 'eventmachine'
require 'em-websocket'
require 'json'
class Connection
attr_accessor :socket, :user_id
def initialize(socket, user_id)
@socket = socket
<message type='chat' id='purple3475c67' to='jaconda@jaconda.im'>
<active xmlns='http://jabber.org/protocol/chatstates'/>
<body>link text &lt;http://google.com?a=1&amp;amp;b=2&gt;</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='jaconda@jaconda.im'>
<active xmlns='http://jabber.org/protocol/chatstates'/>
<body>link text &lt;http://google.com?a=1&amp;amp;b=2&gt;</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;amp;b=2'>link text</a></p></body>
</html>
</message>
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
@mironov
mironov / ruby-dbi.rb
Created March 13, 2013 13:14
ruby-dbi fix for 1.9.3
module DBI
class Row
#
# See Object#clone.
#
# #clone here, however, is a deep copy via Marshal.
#
def clone
Marshal.load(Marshal.dump(self))
end