Skip to content

Instantly share code, notes, and snippets.

View JonasNielsen's full-sized avatar

Jonas Bylov JonasNielsen

View GitHub Profile
@JonasNielsen
JonasNielsen / less_full_error_messages.rb
Created April 27, 2010 20:32
Altering error messages to only show the attribute name in the error message, if the error message starts with a lower-case character
# Put this file with your initializers
# Altering error messages to only show the attribute name in the error message,
# if the error message starts with a lower-case character
if RAILS_GEM_VERSION =~ /^2\.3\.5/
class ActiveRecord::Error
def full_message
if attribute.to_s == 'base' || message =~ /^[[:upper:]]/
message
/* FORM */
<form action="/topics" id="new_topic_form" method="post" onsubmit="new Ajax.Request('/topics', {asynchronous:true, evalScripts:true, method:'post', onComplete:function(request){Form.Element.enable('add_topic_submit')}, onLoading:function(request){Form.Element.disable('add_topic_submit')}, parameters:Form.serialize(this)}); return false;">
<div style="margin:0;padding:0;display:inline">
<input name="authenticity_token" type="hidden" value="6sukkqZzoOtj09Z/vJvkgn00m5PrbdjG3n7DFffaQA0=" />
</div>
<input id="topic_slideshow_id" name="topic[slideshow_id]" type="hidden" value="107" />
<label for="topic_title">Title</label>
<br />
<input id="new_topic_title_field" name="topic[title]" size="30" type="text" />
<br />
= form_for([:admin, @stencil]) do |f|
- if @stencil.errors.any?
#error_explanation
%h2
= pluralize(@stencil.errors.count, "error")
prohibited this stencil from being saved:
%ul
- @stencil.errors.full_messages.each do |msg|
%li= msg
.field
$ rake spec
(in /Users/Jonas/web_projects/auto_crawlers)
/Users/Jonas/.rvm/gems/ruby-1.9.2-p136/gems/nokogiri-1.4.4/lib/nokogiri/xml/node.rb:877: [BUG] unknown type 0x22 (0xc given)
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]
-- control frame ----------
c:0041 p:---- s:0152 b:0152 l:000151 d:000151 CFUNC :root
c:0040 p:0140 s:0149 b:0149 l:000148 d:000148 METHOD /Users/Jonas/.rvm/gems/ruby-1.9.2-p136/gems/nokogiri-1.4.4/lib/nokogiri/xml/node.rb:877
c:0039 p:0013 s:0141 b:0141 l:000140 d:000140 METHOD /Users/Jonas/.rvm/gems/ruby-1.9.2-p136/gems/nokogiri-1.4.4/lib/nokogiri/xml/node.rb:205
c:0038 p:0013 s:0133 b:0133 l:000132 d:000132 METHOD /Users/Jonas/.rvm/gems/ruby-1.9.2-p136/gems/nokogiri-1.4.4/lib/nokogiri/xml/node.rb:247
# Inside EM::Connection 'receive_data(d)' loop
logger.debug "New price received"
extraction = proc {
logger.debug "Extracting price info"
extract_price_information(response) # Use libxml to match response with a schema and extract values
}
callback = proc { |price|
push_to_pusher(price) # Uses pusherapp to broadcast price
}
class MyClass
def my_method(first_name, last_name)
# does something
end
end
MyClass.magic_method(:my_method) # => ["first_name", "last_name"]
formats:
default: "%d.%m.%Y"
short: "%e. %b %Y"
long: "%e. %B %Y"
eng: "%Y-%m-%d"
with_week_day: "%a %d. %e. %B %Y"
weekday_without_year: "%A %d/%m"
day_only: "%A"
day_names:
module SnifferInterface
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def this_is_a_class_method
end
TypeError: can't convert Symbol into Integer
/Users/Jonas/.rvm/gems/ruby-1.9.3-p194@autouncle/gems/iye-1.0.0/lib/i18n_yaml_editor/transformation.rb:25:in `[]='
/Users/Jonas/.rvm/gems/ruby-1.9.3-p194@autouncle/gems/iye-1.0.0/lib/i18n_yaml_editor/transformation.rb:25:in `block (2 levels) in nest_hash'
/Users/Jonas/.rvm/gems/ruby-1.9.3-p194@autouncle/gems/iye-1.0.0/lib/i18n_yaml_editor/transformation.rb:23:in `each'
/Users/Jonas/.rvm/gems/ruby-1.9.3-p194@autouncle/gems/iye-1.0.0/lib/i18n_yaml_editor/transformation.rb:23:in `each_with_index'
/Users/Jonas/.rvm/gems/ruby-1.9.3-p194@autouncle/gems/iye-1.0.0/lib/i18n_yaml_editor/transformation.rb:23:in `block in nest_hash'
/Users/Jonas/.rvm/gems/ruby-1.9.3-p194@autouncle/gems/iye-1.0.0/lib/i18n_yaml_editor/transformation.rb:20:in `each'
/Users/Jonas/.rvm/gems/ruby-1.9.3-p194@autouncle/gems/iye-1.0.0/lib/i18n_yaml_editor/transformation.rb:20:in `nest_hash'
/Users/Jonas/.rvm/gems/ruby-1.9.3-p194@autouncle/gems/iye-1.0.0/lib/i18n_yaml_editor/store.rb:110:in `blo
@JonasNielsen
JonasNielsen / gist:5415216
Created April 18, 2013 18:45
Output from $ vulcan build -v -s ffmpegthumbnailer-2.0.8 -d http://www.ffmpeg.org/releases/ffmpeg-1.2.tar.gz
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for FFMPEG... no
configure: error: Package requirements (libavutil libavformat libavcodec >= 52.26.0 libswscale) were not met:
No package 'libavutil' found
No package 'libavformat' found
No package 'libavcodec' found
No package 'libswscale' found