## Required
# install
sudo gem install utility_belt
# settings for ~/.irbrc
require 'rubygems'
require 'utility_belt'
UtilityBelt::Themes.background(:light) #optional
## Now you can play in irb
# Interactively edit IRB code in TextMate
mate
# read from clipboard
MacClipboard.read
# write to clipboard
MacClipboard.write 'some text to be pasted elsewhere'
# review history
h # 'history' also works, but who wants to type?
# re-play last command
h!
# re-play arbitrary command from history
h! 123
# save history to some file
history_write('/path/to/file')
# find class name
grep_classes("num")
#=> ["Bignum", "Fixnum", "Numeric", "REXML::SyncEnumerator"]
# find method name
"foo".grep_methods("pretty")
#=> ["pretty_inspect", "pretty_print_instance_variables", ... ]
# google for whatever's in clipboard
google
# arbitrary google search
google singleWord
google 'multiple words'
Tag Archive for google
Irb power tricks with Wirble & Utility-Belt
Google Custom Search Engine from a List of Links
<!-- Use of this code assumes agreement with the Google Custom Search Terms of Service. --> <!-- The terms of service are available at /coop/docs/cse/tos.html --> <form name="cse" id="searchbox_demo" action="http://www.google.com/cse"> <input type="hidden" name="cref" value="" /> <input name="q" type="text" size="40" /> <input type="submit" name="sa" value="Search" /> </form> <script type="text/javascript" src="http://www.google.com/cse/tools/onthefly?form=searchbox_demo"></script>
IE Issue decteing SSL for Google Analytics
For HTTP:
<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXX-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
For HTTPS:
<script type="text/javascript" src="https://ssl.google-analytics.com/ga.js"></script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXX-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
Scrape Google from the command line
perl -e "$i=0;while($i<1000){sleep 1; open(WGET,qq/|xargs lynx -dump/);printf WGET qq{http://www.google.com/search?q=site:onemorebug.com&hl=en&start=$i&sa=N},$i+=10}" | grep "//[^/]*onemorebug.com/"
Category: Uncategorized |
Tags: aggregator, analysis, commandline, google, iterator, lynx, metrics, one-liners, perl, results, scraping, search, wget
currency changer with google
<script type="text/javascript">
function callGoogle(){
var form=document.getElementById("Gform");
var link="http://www.google.hu/search?q="+form.elements["value"].value+"+"+form.elements["from"].value+"+to+"+form.elements["to"].value;
location.href=link;
}
</script>
<form id="Gform">
<input type="text" name="value" size="6">
<select name="from">
<option>EUR
<option>HUF
<option>GBP
<option>AUD
<option>CZK
<option>DKK
<option>JPY
<option>CAD
<option>PLN
<option>NOK
<option>CHF
<option>SEK
<option>SKK
<option>USD
</select>
TO
<select name="to">
<option>HUF
<option>GBP
<option>AUD
<option>CZK
<option>DKK
<option>EUR
<option>JPY
<option>CAD
<option>PLN
<option>NOK
<option>CHF
<option>SEK
<option>SKK
<option>USD
</select>
<input type="button" onclick="callGoogle()" value="Change!">
</form>
currency changer with google
<script type="text/javascript">
function callGoogle(){
var form=document.getElementById("Gform");
var link="http://www.google.hu/search?q="+form.elements["value"].value+"+"+form.elements["from"].value+"+to+"+form.elements["to"].value;
location.href=link;
}
</script>
<form id="Gform">
<input type="text" name="value" size="6">
<select name="from">
<option>EUR
<option>HUF
<option>GBP
<option>AUD
<option>CZK
<option>DKK
<option>JPY
<option>CAD
<option>PLN
<option>NOK
<option>CHF
<option>SEK
<option>SKK
<option>USD
</select>
TO
<select name="to">
<option>HUF
<option>GBP
<option>AUD
<option>CZK
<option>DKK
<option>EUR
<option>JPY
<option>CAD
<option>PLN
<option>NOK
<option>CHF
<option>SEK
<option>SKK
<option>USD
</select>
<input type="button" onclick="callGoogle()" value="Change!">
</form>
301 Redirect Google Safe
header("HTTP/1.1 301 Moved Permanently");
header("Location: <a href="http://www.newdomain.com/somepage.html"" >http://www.newdomain.com/somepage.html"</a>);
Remove Google Notebook text
#gnotes-statusbar-lbl {
display: none !important;
}
AppleSearch on your Website
<!-- Google CSE Search Box Begins --> <form id="searchbox_009486749950716717919:edzcv6gfaeg" action="http://www.filippocorti.com/pages/page2/mac/result/"> <input type="hidden" name="cx" value="009486749950716717919:edzcv6gfaeg" /> <input name="q" type="text" size="40" /> <input type="submit" name="sa" value="Apple Search" /> <input type="hidden" name="cof" value="FORID:11" /> </form> <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_009486749950716717919%3Aedzcv6gfaeg"></script> <!-- Google CSE Search Box Ends -->