Skip to content

Instantly share code, notes, and snippets.

RSpec::Matchers.define :render_chart do |expected|
include JsonHelpers
match do |actual|
valid_caption? && valid_value? && valid_label?
end
failure_message_for_should do |actual|
failure_msg = "Expected that: \n"
failure_msg << " - Caption would be '#{@expected_caption}', but got '#{json_response.chart.caption}' \n" unless valid_caption?
Rails 3:
"{\"rendered_panel\":\"<div class=\\\"flow-card-wbw panel\\\" data-card-type=\\\"call_to_action:wellbeingwire\\\" data-challenge-id=\\\"19373\\\" data-impression-id=\\\"1657\\\">\\n <div class=\\\"flow-block-head clearfix\\\">\\n <div class=\\\"flow-block-head-image\\\">\\n <img alt=\\\"\\\" height=\\\"41\\\" src=\\\"http://challenge.myhdev.com/assets/challenge/icons/flow_globe.png\\\" width=\\\"41\\\" /> </div>\\n <div class=\\\"flow-block-head-content\\\">\\n <h2 class=\\\"no_subtitle clearfix\\\"><span class=\\\"title\\\">Well-Being News</span></h2>\\n <a class=\\\"btn_close\\\" href=\\\"#\\\" title=\\\"Close\\\"></a>\\n </div>\\n </div>\\n <div class=\\\"flow-block-content\\\">\\n <div class=\\\"panel_content\\\">\\n\\n <h2>Well-Being Wire:<br/> All new. All for you!</h2>\\n <p>\\n We're trying something special in Daily Challenge! Well-Being Wire is a roundup of health and research news, gathered just for our members. Keep up on big health storie
module ModuleTest
def foo
puts "- Foo on ModuleTest"
super # calls the Foo method on the Parent's class
end
end
class Parent
def foo
puts "- Foo on Parent's class"
@gguerini
gguerini / devise.pt-BR.yml
Created July 6, 2012 18:11 — forked from mateusg/devise.pt-BR.yml
pt-BR translations for Devise
# encoding: UTF-8
# pt-BR translations for Devise
pt-BR:
errors:
messages:
expired: "expirou, por favor, solicite uma nova"
not_found: "não encontrado"
already_confirmed: "já foi confirmado"
not_locked: "não foi bloqueado"
not_saved:
@gguerini
gguerini / macos
Created April 27, 2012 22:05
MacOS Defaults
# Disable menu bar transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
# Show remaining battery time; hide percentage
defaults write com.apple.menuextra.battery ShowPercent -string "NO"
defaults write com.apple.menuextra.battery ShowTime -string "YES"
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true