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 'pry' | |
require 'nokogiri' | |
require 'rest-client' | |
endpoint_url = 'http://reddit.com' | |
response = RestClient.get(endpoint_url) | |
parsed_response = Nokogiri.parse(response) | |
titles = parsed_response.css('.content > .spacer > #siteTable > .thing > .entry > .title > a').map do |node| |
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
<?php | |
$db_host='dbserver'; | |
$db_name='dbame'; | |
$db_user='dbuser'; | |
$db_passwd='dbpassword'; | |
mysql_connect($db_host, $db_user, $db_passwd) | |
or die('Could not connect: ' . mysql_error()); | |
mysql_select_db($db_name) or die('Could not select database'); |