This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
### Functions to work around | |
def fetch_top_movies(top_no) | |
top_movies = Array.new | |
ctr = 0 | |
url = 'http://www.imdb.com/chart/top' | |
This file contains 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 'rubygems' | |
responses = Array.new | |
File.foreach('logs/access.log') do |line| | |
log_line = line.chomp.split(/\s+/) | |
responses << log_line[9] | |
end | |
counts = Hash.new(0) |
This file contains 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
----------------------------------------------------------------------------------------------------------------------------- | |
| | | |
| LIST OF SEARCH APIs ON THE INTERNET COMPILED FOR THE EASE | | |
| | | |
|-----------------------------------------------------------------------------------------------------------------------------| | |
YouTube query: | |
http://gdata.youtube.com/feeds/api/videos?q=SEARCH TERM&v=2&alt=jsonc&max-results=10 | |
Wikipedia query: |
This file contains 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
public function Parse ($url) { | |
$fileContents= file_get_contents($url); | |
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents); | |
$fileContents = trim(str_replace('"', "'", $fileContents)); | |
$simpleXml = simplexml_load_string($fileContents); | |
$json = json_encode($simpleXml); | |
return $json; | |
} |
NewerOlder