Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Hernando County's latest COVID stats</title>
</head>
<body>
<?php
require "config.php";
<?php
require "config.php";
// existing code to fetch numbers here
try {
$connection = new PDO($dsn, $username, $password, $options);
}
catch(PDOException $error) {
echo "Cannot connect to database. Fix that." . "<br>" . $error->getMessage();
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Hernando County's latest COVID stats</title>
</head>
<body>
<?php
$ch = curl_init();
@Ruekompa
Ruekompa / list.rb
Last active August 29, 2015 14:04
Nokogiri and Mechanize Introduction
require 'rubygems'
require 'open-uri'
require 'mechanize'
require 'nokogiri'
class Mechanize::Form
def postback target, argument
self['__EVENTTARGET'], self['__EVENTARGUMENT'] = target, argument
submit
end
@Ruekompa
Ruekompa / today.js
Last active August 29, 2015 14:00
Javascript for mm/dd/yyyy format
<script type="text/javascript">
Date.prototype.yyyymmdd = function() {
var yyyy = this.getFullYear().toString();
var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
var dd = this.getDate().toString();
return (mm[1]?mm:"0"+mm[0]) + '/' + (dd[1]?dd:"0"+dd[0]) + '/' + yyyy;
};