This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <form id="myForm"> | |
| Name: <input type="text" name="name" id="name" /><br/> | |
| Email: <input type="text" name="email" id="email" /><br/> | |
| Password: <input type="text" name="password" id="password" /><br/> | |
| Website: <input type="text" name="website" id="website" /><br/> | |
| <button type="submit" onClick="trackUserEngagement('myForm');">Submit</button> | |
| </form> | |
| <script type="text/javascript"> | |
| // Track user engagement on a form |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'digest' | |
| # = simple_google_analytics.rb | |
| # | |
| # Chris Le <chris at iamchrisle dot com> | |
| # | |
| # This module is an wrapper to export data from Google Analytics as a flattened | |
| # hash suitable for database storage. It does not require any other gems other | |
| # than 'oauth'. I used this simply to get metrics and directly store them in | |
| # a database. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Looks for the escaped fragment meta tag. If found, gets the HTML snapshot | |
| # instead | |
| module GoogleBotSimulator::EscapedFragment | |
| def has_meta_fragment? | |
| (@response.search('//meta[@name="fragment"]/@content').to_s == '!') ? true : false | |
| end | |
| def url_with_escaped_fragment(url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module CapybaraWithPhantomJs | |
| include Capybara | |
| # Create a new PhantomJS session in Capybara | |
| def new_session | |
| # Register PhantomJS (aka poltergeist) as the driver to use | |
| Capybara.register_driver :poltergeist do |app| | |
| Capybara::Poltergeist::Driver.new(app) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'mechanize' | |
| require 'linkscape' | |
| agent = Mechanize.new | |
| agent.user_agent_alias = 'Mac Safari' | |
| # Put your state here | |
| state = "PA" | |
| page = agent.get "http://newsmap.mhlakhani.com/data/US-#{state}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Converts JSON data into CSV and writes to a temporary CSV file | |
| require 'ruport' | |
| # see ruport_19.rb | |
| require 'monkey_patches/ruport_19' | |
| class CsvWriter | |
| # Initialize an instance of CsvWriter | |
| def initialize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ Facebook likes for Excel using DataNitro | |
| [email protected] | |
| http://www.seeinteractive.com/blog/get-facebook-likes-in-excel-using-datanitro | |
| """ | |
| import urllib2 | |
| import json | |
| def facebook_likes(url): | |
| facebook_url = "https://graph.facebook.com/?ids=" + url | |
| raw_data = urllib2.urlopen(facebook_url).read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl --user-agent "-" $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function myFunction() { | |
| var response = UrlFetchApp.fetch("http://www.google.com/search?q=law%20firm%20boston,%20ma&num=10").getContentText(); | |
| Logger.log(response); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl --user-agent "Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120403211507 Firefox/12.0" http://www.google.com/search\?q\=law%20firm%20boston,%20ma |