Skip to content

Instantly share code, notes, and snippets.

string = "| t%%> + ~+$ -+*> t% ~y r%%~, | s~%>&@ #|~ |$ -&@."
string = string.gsub(/[|]/, 'i')
#string = string.gsub(/[]/, '')
#string = string.gsub(/[]/, '')
#string = string.gsub(/[]/, '')
puts string
require 'win32/sound'
include Win32
#count = 50
Sound.beep(150, 5)
Sound.beep(200, 5)
Sound.beep(250, 5)
Sound.beep(300, 55)
Sound.beep(350, 125)
Sound.beep(400, 100)
@MelanieS
MelanieS / hub_lister
Created February 5, 2012 07:51
Lists names, urls, and text of all of a HubPages users' hubs
#http://www.codegurl.com/2012/02/disguising-load-times-w-information.html
require 'nokogiri'
require 'open-uri'
def create_base_url(username)
#takes hub username and turns it into url using 'lastest'
base_url = "http://#{username}.hubpages.com/hubs/latest".to_s
end
def get_index_pages(base_url, username)
@MelanieS
MelanieS / find_naughty_hubbers
Created December 1, 2011 08:24
Script finds hubbers that have a authorscore of five and under (hubpages.com)
require 'nokogiri'
require 'open-uri'
=begin __
/ _)
_.----._/ /
/ /
__/ ( | ( |
/__.-'|_|--|_|
http://hubpages.com/forum/topic/87923
@MelanieS
MelanieS / gist:1318931
Created October 27, 2011 06:41
rubydoctest
=begin
doctest: My hello method returns "Hello World!"
>> hello
=> "Hello World!"
doctest: I can pass a name to my hello method and get "Hello Melanie"
>> hello "Melanie"
=> "Hello Melanie!"
doctect: I can even ask a question by passing hello "Victor", "?"
>> hello("Victor", "?")
=>"Hello victor?"
@MelanieS
MelanieS / ad_change
Created October 27, 2011 06:17
ad_change
<div class='post-header-line-1'/>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<!-- If user is on an index page-->
<div style='float:right;'>
AD CODE (size 125 x 125)
</div>
</b:if>
<b:if cond='data:blog.url != data:blog.homepageUrl'>
<!-- If user is on any page other than an index page -->
<div class="post-header-line-1">
<div style="float: right;">
AD CODE (size 200 x 200)
</div>
@MelanieS
MelanieS / books.pl
Created August 30, 2011 11:08
Playing with heredocs & conditionals in Perl
#!/usr/bin/perl
use strict;
use warnings;
my $books = <<'END_OF_REPORT';
1 The Well-Grounded Rubyist
2 Pragmatic Thinking & Learning
3 Programming Ruby 1.9
4 Learning Perl
END_OF_REPORT
@MelanieS
MelanieS / WLChecker
Created August 18, 2011 20:57
Checks posts in a blog and returns posts that aren't long enough
require 'nokogiri'
require 'open-uri'
def get_posts(url)
posts = []
doc = Nokogiri::HTML(open(url))
doc.css('link[rel=alternate]').each do |e|
posts << e['href']
end
posts = posts.drop(1)
@MelanieS
MelanieS / RankyPanky.rb
Created August 15, 2011 15:49
RankyPanky SERP Checker
require 'sinatra'
require 'nokogiri'
require 'open-uri'
get '/serp_checker' do
"<form action='/ranked' method='post'>
<label for='keyword'>Keyword</label>
<textarea name='keyword' id='keyword' type='text' /></textarea>
<label for='url'>URL</label>
<input name='url' id='url' type='text' />