Skip to content

Instantly share code, notes, and snippets.

View BilalBudhani's full-sized avatar
👀
Looking for something interesting to work on

Bilal Budhani BilalBudhani

👀
Looking for something interesting to work on
View GitHub Profile
@BilalBudhani
BilalBudhani / 0_reuse_code.js
Created November 24, 2013 16:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@BilalBudhani
BilalBudhani / imdb_fetch.rb
Last active December 21, 2015 05:19
ruby imdb_fetch.rb -n 10 "Morgan Freeman"
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'
@BilalBudhani
BilalBudhani / log_data.rb
Last active December 21, 2015 05:19
Ruby code to read apache logs and count the server response.
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)
@BilalBudhani
BilalBudhani / api_list.txt
Last active March 4, 2024 01:55
List of Search APIs of various social platforms
-----------------------------------------------------------------------------------------------------------------------------
| |
| 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:
@BilalBudhani
BilalBudhani / rssToJson
Created January 31, 2013 10:04
PHP function to convert simple RSS to JSON
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;
}