Skip to content

Instantly share code, notes, and snippets.

View denysonique's full-sized avatar

Dennis Prochniak denysonique

View GitHub Profile
From 68641f096d2a48ee3e1dfabd17c455a3a8d397c4 Mon Sep 17 00:00:00 2001
From: denysonique <dennisonic@gmail.com>
Date: Sun, 12 Oct 2014 02:46:57 +0100
Subject: [PATCH] implement Config[:scrape][:url_blacklist] blacklisting
---
plugins/scrape.rb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/plugins/scrape.rb b/plugins/scrape.rb
class Greeter
def self.say_hi name
puts "Hi #{name}."
end
end
=begin
Output:
irb(main):007:0> Greeter.say_hi 'Ruby'
Hi Ruby.
class Greeter:
@staticmethod
def say_hi(name):
print ('Hi %s.') % name
#Output:
# Greeter.say_hi('Python')
# >> Hi Python.
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
@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"]
We couldn’t find that file to show.
$('document').ready(function() {
// Don't work
$( "#message_number_false" ).click(
function() {
$( "#call_back_text" ).show(100);
});
// Don't work
$( "#message_number_true" ).click(
function() {
Thank you for your continued patience during this process. Our specialists
have re-reviewed your accounts and have determined that our decision is
correct and final. As a result, your account and any related accounts that
you may have created have been suspended, and your ads will no longer run
on Google.
NEXT STEPS
, our support team is unable to provide any further information on this
matter.
- Please refrain from creating additional AdWords accounts, as they will
be subject to the same suspension.
begin
variable = x.some_method.hax
rescue
variable = x.some_method.foo
rescue
variable = x.some_method.bar
end
#I would like to acheive something similar to:
variable = x.some_method.hax
begin
subject.title = (document/"title").first.inner_html
rescue
subject.title = ''
end
begin
subject.description = (document/"meta[subject.name=description]").first[:content]
rescue
subject.description = ActionController::Base.helpers.strip_tags((document/"p").first.inner_html)