Skip to content

Instantly share code, notes, and snippets.

def rating
url_path = '/rating';# + id
header "Accept", "text/xml"
visit(
@url + url_path,
:post
)
end
/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
use HTML::TreeBuilder;
my $agent = WWW::Mechanize->new();
$agent->get("http://www.gumtree.com/london/79/52349379.html");
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
_search();
sub _search {
#do search
http://www.centuryfurniture.com/RetailerLocator/Locate.aspx
POST /RetailerLocator/Locate.aspx HTTP/1.1
Host: www.centuryfurniture.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.11) Gecko/2009060214 Firefox/3.0.11
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
@zsan
zsan / p-find.pl
Created October 9, 2012 20:02
simple example of the power File::Find
#!/usr/bin/env perl
use Modern::Perl;
use File::Find;
#--------------------------------------------------
# no getopt since its very simple
#--------------------------------------------------
die "Enter a directory to search\nUsage: perl $0 <dir_path>" unless @ARGV;
my $total_size = 0;
> db.linkedin_skills.find({displayName: "TOGAF"}).pretty()
{
"_id" : ObjectId("51659c9ee138231e2b000c01"),
"displayName" : "TOGAF",
"generated_from" : "to",
"growth_rate_decreasing" : "",
"growth_rate_increasing" : "2%",
"headLine" : "<strong>TO</strong>GAF",
"linkedin_id" : "5056",
"primary_industry" : "Information Technology and Services",
- id:
bioguide: B000944
thomas: '00136'
lis: S307
govtrack: 400050
opensecrets: N00003535
votesmart: 27018
@zsan
zsan / user.erb
Created September 17, 2013 18:03
<% if signed_in? %>
<div class="row">
<aside class="span4">
<section>
<%= render 'shared/user_info' %>
</section>
<section>
<%= render 'shared/stats' %>
</section>
<section>
# ONLY ALLOW REGISTER WHEN SIGNED OUT
if ($v{'user_id'} ne '') {
# PAGE TELLING USER TO SIGN OUT
} else {
# THERE ARE 2 POSSIBILITIES HERE
# 1. NEW USER AND WE"RE GOING TO PROVIDE THEM REGISTRATION FORM
# 2. SUBMITTED PARAMETERS FROM USER REGISTRATION FORM
# AND WE'RE GOING TO PROVIDE THEM CHECKBOXES TO SUBSCRIBE,
@zsan
zsan / index.html
Last active December 29, 2015 19:18
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>RSpec results</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="Pragma" content="no-cache" />