Skip to content

Instantly share code, notes, and snippets.

View skorfmann's full-sized avatar

Sebastian Korfmann skorfmann

View GitHub Profile
$('.images').append('<%= escape_javascript(render(:partial => "image", :object => @image)) %>');
$('#<%= dom_id(@image) %> span').rest_in_place('<%= image_path(@image) %>', 'image', 'title');
if ($('#images').css('display') == 'none') {
$('#images').slideDown(1000);
}
require 'rubygems'
IRB.conf[:AUTO_INDENT] = false
IRB.conf[:USE_READLINE] = true
class Object
# easy way to list an object's methods without clutter
def local_methods
(methods - Object.instance_methods).sort
end
end
require 'rubygems'
#doesn't work as expected. conflicts with utility belt
if ENV.include?('RAILS_ENV')
if !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT))
end
require 'hirb'
require 'rubygems'
puts "testing'
<%
allowed_extensions = [:jpg, :jpeg]
max_size = 10.megabyte
allow_multiple_files = true
button_label = t('uploadify.choose')
url = url_for(:slideshow_id => slideshow, :action => :create, :controller => :slides)
%>
<%- session_key_name = ActionController::Base.session_options[:key] -%>
<% content_for :header do -%>
<%= javascript_include_tag "swfobject" %>
class ShippingOption # Base class
@children = []
def self.inherited(child)
@children << child
end
def self.shipping_options(weight, international)
@children.select {|child| child.can_ship?(weight, international)}
end
end
class One
def self.inherited(by)
by.instance_eval do
class << self
define_method(:test) do
puts "it works from #{self}"
end
end
end
#
# Copyright 2000-2009 JetBrains s.r.o.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
raise Exception.new
#oder
raise Exception.new("hallo")
#oder auch eigene Exceptions implementieren
class MyTinyException < StandardError
end
<h1>Your Pragmatic Catalog </h1>
<% @products.each do |product| %>
<div class="entry">
<%= link_to image_tag(product.image_url) , line_items_path(:product_id => product.id) ,
:method => :post %>
<h3><%= product.title %></h3>
<%=raw product.description %>