Skip to content

Instantly share code, notes, and snippets.

View denysonique's full-sized avatar

Dennis Prochniak denysonique

View GitHub Profile
$('document').ready(function() {
// Don't work
$( "#message_number_false" ).click(
function() {
$( "#call_back_text" ).show(100);
});
// Don't work
$( "#message_number_true" ).click(
function() {
We couldn’t find that file to show.
@denysonique
denysonique / gist:888302
Created March 26, 2011 14:07
Example given by Apeiros, how to use his css parser to edit CSS.
css = Browsr::CSS.new
css.append_external_stylesheet(
"#example-id { font-size: 12px; }", # the css definitions
:author_style_sheet, # origin of the definitions (relevant for specificity)
Browsr::CSS::Media::AllMedia, # media these rules apply for
"(demofile)", # file to report for definitions & errors
1 # line to report for definitions & errors
)
ruleset = css.first # normally you'd ask for all rulesets for a given medium
rule = ruleset.rules["#example-id"]
def add_line_item_to_cart
#Get current_cart object
current_cart
quantity = params[:quantity].to_i
id = params[:id].to_i
line_item = LineItem.find(:first, :conditions => {:cartridge_id => id, :cart_id => current_cart.id})
if line_item
line_item.cart_id = current_cart.id
class Greeter:
@staticmethod
def say_hi(name):
print ('Hi %s.') % name
#Output:
# Greeter.say_hi('Python')
# >> Hi Python.
class Greeter
def self.say_hi name
puts "Hi #{name}."
end
end
=begin
Output:
irb(main):007:0> Greeter.say_hi 'Ruby'
Hi Ruby.