lunes, 27 de noviembre de 2023

Count Textarea Characters with JavaScript


I've been playing around with the Twitter API lately and, as you know, Tweets can only be 140 characters long. I wanted to use a textarea element, not an input type="text", so I couldn't just use maxchars to limit the number of characters. Additionally, I get annoyed when my text is chopped off when pasting. So, what to do? Well, I thought, why not make a little character counter like the one you find on the actual Twitter?

The first step is to create the JavaScript function. I placed mine in a file called count-chars.js and it looks like this:

function countChars(textbox, counter, max) {
  var count = max - document.getElementById(textbox).value.length;
  if (count < 0) { document.getElementById(counter).innerHTML = "<span style=\"color: red;\">" + count + "</span>"; }
  else { document.getElementById(counter).innerHTML = count; }
}

textbox and counter are the IDs of the elements of the textarea we're counting and the span where the count is going to go, respectively.

There's lots you can customize there. You could disable the form if too many characters are entered or you could automatically truncate the text. But, I prefer to just have the warning show up in red text.

The next step is to write the HTML itself:

<script type="text/javascript" src="/js/count-chars.js"></script>
<form action="#" method="POST">
<p>Tweet Something: <span id="char_count"></span><br><textarea name="tweet" id="textbox" class="form-control" rows="3" cols="60" onFocus="countChars('textbox','char_count',140)" onKeyDown="countChars('textbox','char_count',140)" onKeyUp="countChars('textbox','char_count',140)"></textarea></p>
<p><input type="submit" class="btn btn-primary" value="Tweet" /></p>
</form>

domingo, 15 de octubre de 2023

GPT PDF

 https://nanonets.com/blog/chat-with-pdfs-using-chatgpt-and-openai-gpt-api/

lunes, 9 de octubre de 2023

Google tts audio generation


https://cloud.google.com/text-to-speech/docs/audio-profiles


 To generate an audio file, make a POST request and provide the appropriate request body. The following shows an example of a POST request using curl. The example uses the access token for a service account set up for the project using the Google Cloud Platform Cloud SDK. For instructions on installing the Cloud SDK, setting up a project with a service account, and obtaining an access token, see the Quickstarts.



The following example shows how to send a request to the text:synthesize endpoint.

curl \
 
-H "Authorization: Bearer "$(gcloud auth print-access-token) \
 
-H "Content-Type: application/json; charset=utf-8" \
 
--data "{
    'input':{
      'text':'This is a sentence that helps test how audio profiles can change the way Cloud Text-to-Speech sounds.'
    },
    'voice':{
      'languageCode':'en-us',
    },
    'audioConfig':{
      'audioEncoding':'LINEAR16',
      'effectsProfileId': ['telephony-class-application']
    }
  }"
"https://texttospeech.googleapis.com/v1beta1/text:synthesize" > audio-profile.txt

If the request is successful, the Text-to-Speech API returns the synthesized audio as base64-encoded data contained in the JSON output. The JSON output in the audio-profiles.txt file looks like the following:

{
 
"audioContent": "//NExAASCCIIAAhEAGAAEMW4kAYPnwwIKw/BBTpwTvB+IAxIfghUfW.."
}

To decode the results from the Cloud Text-to-Speech API as an MP3 audio file, run the following command from the same directory as the audio-profiles.txt file.

sed 's|audioContent| |' < audio-profile.txt > tmp-output.txt && \
tr -d '\n ":{}' < tmp-output.txt > tmp-output-2.txt && \
base64 tmp-output-2.txt --decode > audio-profile.wav && \
rm tmp-output*.txt

miércoles, 27 de septiembre de 2023

PDF search and sort

pdfgrep -P '\(809|829|849\)\d{7}' VILLA-NAZARET-BAYONA.pdf  | grep -oP '\((809|829|849)\).{10}'


pdfgrep -P '\(809|829|849\)\d{7}' VILLA-NAZARET-BAYONA.pdf | grep -oP '\((809|829|849)\).{10}' | sed 's/[^0-9]//g'






pdfgrep -P '\(809|829|849\)\d{7}' PRM_HATO NUEVO.pdf | grep -oP '\((809|829|849)\).{10}' | sed 's/[^0-9]//g' >  PRM _ MANOGUAYABO.txt

miércoles, 9 de agosto de 2023

domingo, 25 de junio de 2023

find if a word or substring exist based on php array

 <?php



$acctname = array(

    "Nash_paid",

    "Nash_Orange",

    "Sagi_Orange",

    "Sagu_paid",

    "Red_Phone",

    "Main_Paid",

    "Abi_Orange",

    "Abi_paid",

    "Repeated client_",

    "Meni_Road",

    "Meni_Towing",

    "Main_line");



$string="Red_Phone";

foreach($acctname as $substring){

if (stripos($string, $substring) !== false) {


echo  "$substring<br>";

}

}


?>

get the the monday and sunday from a week a go

 <?php

// Get the current date

$currentDate = date('Y-m-d');


// Calculate the previous week's Monday

$previousMonday = date('Y-m-d', strtotime($currentDate . ' -1 week monday'));


// Calculate the previous week's Sunday

$previousSunday = date('Y-m-d', strtotime($currentDate . ' -1 week sunday'));


// Display the results

echo "Previous Week's Monday: " . $previousMonday . "<br>";

echo "Previous Week's Sunday: " . $previousSunday . "<br>";

?>


sábado, 6 de mayo de 2023

html table

<!DOCTYPE html>

<html>

<head>

<style>

* {

    /* Change your font family */

    font-family: sans-serif;

}


.content-table {

    border-collapse: collapse;

    margin: 25px 0;

    font-size: 0.9em;

    min-width: 400px;

    border-radius: 5px 5px 0 0;

    overflow: hidden;

    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);

}


.content-table thead tr {

    background-color: #009879;

    color: #ffffff;

    text-align: left;

    font-weight: bold;

}


.content-table th,

.content-table td {

    padding: 12px 15px;

}


.content-table tbody tr {

    border-bottom: 1px solid #dddddd;

}


.content-table tbody tr:nth-of-type(even) {

    background-color: #f3f3f3;

}


.content-table tbody tr:last-of-type {

    border-bottom: 2px solid #009879;

}


.content-table tbody tr.active-row {

    font-weight: bold;

    color: #009879;

}



</style>

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>How to Style HTML Tables with CSS</title>

    <link rel="stylesheet" href="css/main.css">

</head>

<body>

    <table class="content-table">

        <thead>

          <tr>

            <th>Rank</th>

            <th>Name</th>

            <th>Points</th>

            <th>Team</th>

          </tr>

        </thead>

        <tbody>

          <tr>

            <td>1</td>

            <td>Domenic</td>

            <td>88,110</td>

            <td>dcode</td>

          </tr>

          <tr class="active-row">

            <td>2</td>

            <td>Sally</td>

            <td>72,400</td>

            <td>Students</td>

          </tr>

          <tr>

            <td>3</td>

            <td>Nick</td>

            <td>52,300</td>

            <td>dcode</td>

          </tr>

        </tbody>

      </table>

</body>

</html>


 https://dcode.domenade.com/tutorials/how-to-style-html-tables-with-css

Dashboarc code

 <!DOCTYPE html>

<html>

<head>

<style>

.grid-container {

  display: grid;

  grid-template-columns: repeat(2, 1fr);

  grid-gap: 20px;

}


.grid-item {

  display: flex;

  justify-content: center;

  align-items: center;

  height: 150px;

  border-radius: 5px;

  box-shadow: 0 2px 4px rgba(0,0,0,.2);

  font-size: 4rem;

}


.red {

  background-color: #FF5252;

  color: white;

}


.blue {

  background-color: #2196F3;

  color: white;

}


.green {

  background-color: #4CAF50;

  color: white;

}


.yellow {

  background-color: #FFC107;

  color: white;

}


i {

  font-size: 1.5rem;

}


</style>

<title>Page Title</title>

</head>

<body>


<div class="grid-container">

  <div class="grid-item red">


    <i class="fas fa-phone">  Active</i>

  </div>

  <div class="grid-item blue">

    <i class="fas fa-phone"> ICC</i>

  </div>

  <div class="grid-item green">

    <i class="fas fa-phone">FFF</i>

  </div>

  <div class="grid-item yellow">

    <i class="fas fa-phone">DD</i>

  </div>

</div>



</body>

</html>


jueves, 27 de abril de 2023

gpt-3.5-turbo API

<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.openai.com/v1/chat/completions');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

curl_setopt($ch, CURLOPT_HTTPHEADER, [

    'Authorization: Bearer $API_KEY',

    'Content-Type: application/json',

]);



$model="gpt-3.5-turbo";

curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"model\": \"$model\",\n \"messages\": [{\"role\": \"user\", \"content\": \"$argv[1]\"}] \n }");


$response = curl_exec($ch);

 $object=json_decode($response);

$array = json_decode(json_encode($object), true);

//print_r($array);  //uncoment for details

echo $array['choices'][0]['message']['content'];

echo "\n";

curl_close($ch);


?>




curl https://api.openai.com/v1/chat/completions \

  -H "Content-Type: application/json" \

  -H "Authorization: Bearer $OPENAI_API_KEY" \

  -d '{

    "model": "gpt-3.5-turbo",

    "messages": [{"role": "user", "content": "Hello!"}]

  }'

https://platform.openai.com/docs/api-reference/chat/create

miércoles, 26 de abril de 2023

GPT Whisper OpenAI

<?php

$api_key="sk-dLwvC;


$audio_file="$argv[1]";


$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.openai.com/v1/audio/transcriptions');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

curl_setopt($ch, CURLOPT_HTTPHEADER, [

    "Authorization: Bearer $api_key",

    'Content-Type: multipart/form-data',

]);

curl_setopt($ch, CURLOPT_POSTFIELDS, [

    'file' => new CURLFile("$audio_file"),

    'model' => 'whisper-1',

]);


$response = curl_exec($ch);


$array = json_decode($response, true);

echo $array['text'];

curl_close($ch);

?>



 curl https://api.openai.com/v1/audio/transcriptions \

  -H "Authorization: Bearer MYAPIKEY" \

  -H "Content-Type: multipart/form-data" \

  -F file="@/home/ambiorixg12/Downloads/brussell-aportes-reg.mp3" \

  -F model="whisper-1"

openai audio/transcription

 curl https://api.openai.com/v1/audio/transcriptions \

  -H "Authorization: Bearer MYAPIKEY" \

  -H "Content-Type: multipart/form-data" \

  -F file="@/home/ambiorixg12/Downloads/brussell-aportes-reg.mp3" \

  -F model="whisper-1"

  

  

  

  curl https://api.openai.com/v1/audio/transcriptions   -H "Authorization: Bearer MYAPIKEY"   -H "Content-Type: multipart/form-data"  -s  -F file="@/home/ambiorixg12/Downloads/daury.mp3"   -F model="whisper-1"  | awk -F':"' '{print $2}' | awk -F'"}' '{print $1}'




var=$(curl https://api.openai.com/v1/audio/transcriptions   -H "Authorization: Bearer MYAPIKEY"   -H "Content-Type: multipart/form-data"  -s  -F file="@/home/ambiorixg12/Downloads/daury.mp3"   -F model="whisper-1"  | awk -F':"' '{print $2}' | awk -F'"}' '{print $1}')

sábado, 22 de abril de 2023

jueves, 9 de marzo de 2023

Update a select based on the values of other select


<script>

  function updateCities(country){

    var cities;

    if (country == 'Japan'){

      cities = ['Tokyo', 'Osaka', 'Kyoto'];

    } else if (country == 'USA'){

      cities = ['New York', 'Los Angeles', 'Chicago'];

    } else if (country == 'Australia'){

      cities = ['Sydney', 'Melbourne', 'Brisbane'];

    }

    

    // clear current city values

    document.getElementById('city').innerHTML = '';

        document.getElementById('city2').innerHTML = '';


    

    // add new city values

    for (var i = 0; i < cities.length; i++){

      var opt = document.createElement('option'); 

      opt.innerHTML = cities[i];

      opt.value = cities[i];

      document.getElementById('city').appendChild(opt);

    

    //

     var opt = document.createElement('option'); 

      opt.innerHTML = cities[i];

      opt.value = cities[i];

      document.getElementById('city2').appendChild(opt);

    

    //

    

    }

    

    

    

  }

</script>

<label>>


<select id="country" onchange="updateCities(this.value)">

  <option value="Japan">Japan</option>

  <option value="USA">USA</option>

  <option value="Australia">Australia</option>

</select>

<select id="city">

  <option value="none">- Select a City -</option>

</select>


<select id="city2">

  <option value="none">- Select a City2 -</option>

</select>



domingo, 5 de marzo de 2023

sábado, 25 de febrero de 2023

HTML TABLE

 https://www.w3schools.com/css/tryit.asp?filename=trycss_table_fancy

jueves, 23 de febrero de 2023

add html elements clicking a button

 <form action="" method="post" id="form">

    <div class="textfields-container">

        <div class="textfield-container"></div>

    </div>

    <input type="button" name="addTextfield" id="addTextfield" value="Add Textfield"/>

    <input type="submit" value="Submit"/>

</form>


<script>

    document.getElementById("addTextfield").addEventListener("click", function(){

        var textfield = document.createElement("input");

        textfield.type = "text";

        textfield.name = "textfield[]";

        var textfieldContainer = document.querySelector(".textfields-container");

        textfieldContainer.appendChild(textfield);

    });

</script>


domingo, 19 de febrero de 2023

upload file

 


<?php


$target_dir = "uploads/"; 

$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

$uploadOk = 1;

$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));


// Check if image file is a actual image or fake image


if(isset($_POST["submit"])) {

  check if file is type of image

    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);

    if($check !== false) {

        echo "file is an image  " . $check['mime'] .".";

        $uploadOk = 1;

    } else {

        echo "file is not an image";

        $uploadOk = 0;

    }

}


if ($uploadOk == 0) {

    echo "problem occured while uploading";

// if everything is ok, try to upload file

} else {

    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {

        echo "image file ". basename( $_FILES["fileToUpload"]["name"]). " has been successfully uploaded.";

    } else {

        echo " problem occured while uploading";

    }

}


google tts command

 /usr/bin/php /root/google_tts/google_tts_asterisk_es.php "Hola mi  nombre es Ambiorix" >/root/google_tts/audios/audio.txt && 

/usr/bin/php /root/google_tts/convert.php audio



/usr/bin/php /root/google_tts/google_tts_asterisk.php "Hello Ambiorix" >/root/google_tts/audios/audio.txt &&  /usr/bin/php /root/google_tts/convert.php audio

jueves, 9 de febrero de 2023

Sending SMS from csv

 


<?php


require __DIR__ . "/vendor/autoload.php";

 

use Telnyx\Api\ApiClient;

use Telnyx\Api\Message;


// Read the csv file

$file = fopen('file.csv', 'r');


// Set the api key

$telnyx = new ApiClient("YOUR_API_KEY");


while (($line = fgetcsv($file)) !== FALSE) {

    // Retrieve data from the csv

    $phoneNumber = $line[0];

    $message = $line[1];


    // Send the SMS message

    $message = Message::create([

        "from" => "+18881234567",

        "to" => $phoneNumber,

        "text" => $message

    ]);

    echo "\n Sent SMS to {$phoneNumber}: {$message->text}\n";

}


// Close the file

fclose($file);



?>


--------------------------------------------------------------------------------------------------------


This code assumes that the csv file contains data structured like this:

  Name, Phone Number

  John, +19998881234

  Sam, +14447778899


<?php

$csvFile = fopen('contactList.csv', 'r');

$telnyx = new Telnyx\Client('YOUR_TELNYX_API_KEY');


// Iterate over each row in the CSV file

while (($row = fgetcsv($csvFile)) !== FALSE) {

  // Set recipient name and number

  $name = $row[0];

  $number = $row[1];


  // Set message body

  $message = new Telnyx\SMSMessage(

    ["from" => "+15551234567",

     "to" => $number,

     "text" => "Hey, $name! Test message from Telnyx."]

  );


  // Send the message

  $response = $telnyx->SMS->messages->create($message);

}


fclose($csvFile);

?>

martes, 7 de febrero de 2023

google tts and speech api

 https://cloud.google.com/text-to-speech/docs/voices

https://cloud.google.com/speech-to-text/docs/speech-to-text-supported-languages

https://cloud.google.com/speech-to-text/docs/transcribe-api

https://cloud.google.com/text-to-speech/docs/libraries#client-libraries-usage-nodejs

https://cloud.google.com/text-to-speech


    1. Make sure billing is enabled for Speech-to-Text.
    2. Create and/or assign one or more service accounts to Speech-to-Text.
    3. Download a service account credential key.
  • Set your authentication environment variable.
  • (Optional) Create a new Google Cloud Storage bucket to store your audio data.


https://cloud.google.com/speech-to-text/docs/before-you-begin


miércoles, 1 de febrero de 2023

gpt php request

<?php

$url = "https://api.openai.com/v1/completions";


$data = array('prompt' => $argv[1],'max_tokens' =>10, 'model'=> 'text-davinci-003','max_tokens'=>4000,'temperature'=> 1.0);

$encodedData = json_encode($data);



//$data = array(\"param1\" => \"value1\",\"param2\" => \"value2\"\);



$headers = array('Content-Type: application/json','Authorization:Bearer my-key-sdLwvCv');


$curl = curl_init();

$data_string = urlencode(json_encode($data));



curl_setopt($curl, CURLOPT_URL, $url);

curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

curl_setopt($curl, CURLOPT_POST, 1);

//curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));

curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedData);



curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($curl);

curl_close($curl);

//echo $response;  //uncoment this line if you need log info

$object=json_decode($response);

$array = (array) $object;


$response=(array)$array['choices'][0];

echo  $response['text'];

echo  "\n";

?>

viernes, 27 de enero de 2023

curl flowroute API

 <?php

$username="ambiorixg12";

$password="d9914a2s1111refadfe43";

$url = "https://api.flowroute.com/v2.1/messages";

$data = array(

    "to" => "12057143489",

    "from" => "18452375521",

    "body" => "jane_mc@gmail.com",

);

$encodedData = json_encode($data);

$curl = curl_init($url);

$data_string = urlencode(json_encode($data));

curl_setopt($curl, CURLOPT_USERPWD, $username . ":".$password);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");

curl_setopt( $curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));

curl_setopt($curl, CURLOPT_POST, true);

curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedData);

$result = curl_exec($curl);

curl_close($curl);

print $result;


?>

https://developer.flowroute.com/api/messages/v2.1/send-an-sms/


https://phppot.com/php/php-curl-post/
curl version


curl https://api.flowroute.com/v2.1/messages \
-H "Content-Type: application/vnd.api+json" -X POST -d \
'{"to": "18412345676", "from": "18452375521", "body": "Hello World !"}' \
-u ambiorixg12:d99a3deadfe43

viernes, 13 de enero de 2023

gogle calendar

 -------------------

require_once __DIR__ . '/vendor/autoload.php';


// Get the API client and construct the service object.

$client = getClient();

$service = new Google_Service_Calendar($client);


// Define the event details.

$event = new Google_Service_Calendar_Event(array(

    'summary' => 'Test Event',

    'location' => 'Test Location',

    'description' => 'Test Description',

    'start' => array(

        'dateTime' => '2022-01-01T09:00:00-07:00',

        'timeZone' => 'America/Los_Angeles',

    ),

    'end' => array(

        'dateTime' => '2022-01-01T17:00:00-07:00',

        'timeZone' => 'America/Los_Angeles',

    ),

));


// Insert the event into the calendar.

$calendarId = 'primary';

$event = $service->events->insert($calendarId, $event);

---------------------------------------

require_once __DIR__ . '/vendor/autoload.php';

$client = new Google_Client();
$client->setApplicationName('My Calendar App');
$client->setScopes(Google_Service_Calendar::CALENDAR);
$client->setAuthConfig('credentials.json');
$client->setAccessType('offline');
$calendarService = new Google_Service_Calendar($client);

$event = new Google_Service_Calendar_Event(array(
  'summary' => 'Test Event',
  'location' => 'My House',
  'description' => 'Testing the calendar API',
  'start' => array(
    'dateTime' => '2022-03-28T09:00:00-07:00',
    'timeZone' => 'America/Los_Angeles',
  ),
  'end' => array(
    'dateTime' => '2022-03-28T17:00:00-07:00',
    'timeZone' => 'America/Los_Angeles',
  ),
  'recurrence' => array(
    'RRULE:FREQ=DAILY;COUNT=2'
  ),
  'attendees' => array(
    array('email' => 'attendee1@example.com'),
    array('email' => 'attendee2@example.com'),
  ),
  'reminders' => array(
    'useDefault' => FALSE,
    'overrides' => array(
      array('method' => 'email', 'minutes' => 24 * 60),
      array('method' => 'popup', 'minutes' => 10),
    ),
  ),
));

$calendarId = 'primary';
$event = $calendarService->events->insert($calendarId, $event);
printf('Event created: %s\n', $event->htmlLink);

------------------



To install the Google Calendar PHP REST API, you will need to use Composer, a package manager for PHP. Here are the general steps to install the API:

  1. Install Composer if you haven't already by following the instructions on their website: https://getcomposer.org/

  2. In your project directory, create a new file called "composer.json"

  3. In the composer.json file, add the following require statement: "require": { "google/apiclient": "^2.0" }

  4. Run the following command in your terminal: composer install

  5. In your PHP script, include the autoloader file by adding the following line at the top of your script: require_once 'vendor/autoload.php';

  6. Use the Google Calendar API by creating an instance of the Google_Client class and using its methods to interact with the Calendar API.

  7. You also need to setup a google project in order to get the credentials(client_id, client_secret, etc) to use it in your php script.

  8. Once you are authenticated and authorized, you can now use the Google Calendar API to manage calendar events, create new calendars, and more.

Please note that this is a high-level overview of the process and you should refer to the official documentation for more detailed instructions and examples: https://developers.google.com/calendar/api/v3/quickstart/php

domingo, 1 de enero de 2023

Mobile Responsive table

 <style>

table {
  border: 1px solid #ccc;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  width: 100%;
  table-layout: fixed;
}

table caption {
  font-size: 1.5em;
  margin: .5em 0 .75em;
}

table tr {
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  padding: .35em;
}

table th,
table td {
  padding: .625em;
  text-align: center;
}

table th {
  font-size: .85em;
  letter-spacing: .1em;
  text-transform: uppercase;
}

@media screen and (max-width: 600px) {
  table {
    border: 0;
  }

  table caption {
    font-size: 1.3em;
  }
  
  table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }
  
  table tr {
    border-bottom: 3px solid #ddd;
    display: block;
    margin-bottom: .625em;
  }
  
  table td {
    border-bottom: 1px solid #ddd;
    display: block;
    font-size: .8em;
    text-align: right;
  }
  
  table td::before {
    /*
    * aria-label has no advantage, it won't be read inside a table
    content: attr(aria-label);
    */
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
  }
  
  table td:last-child {
    border-bottom: 0;
  }
}














/* general styling */
body {
  font-family: "Open Sans", sans-serif;
  line-height: 1.25;
}
</style>
<table>
  <caption>Statement Summary</caption>
  <thead>
    <tr>
      <th scope="col">Account</th>
      <th scope="col">Due Date</th>
      <th scope="col">Amount</th>
      <th scope="col">Period</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td data-label="Account">Visa - 3412</td>
      <td data-label="Due Date">04/01/2016</td>
      <td data-label="Amount">$1,190</td>
      <td data-label="Period">03/01/2016 - 03/31/2016</td>
    </tr>
    <tr>
      <td scope="row" data-label="Account">Visa - 6076</td>
      <td data-label="Due Date">03/01/2016</td>
      <td data-label="Amount">$2,443</td>
      <td data-label="Period">02/01/2016 - 02/29/2016</td>
    </tr>
    <tr>
      <td scope="row" data-label="Account">Corporate AMEX</td>
      <td data-label="Due Date">03/01/2016</td>
      <td data-label="Amount">$1,181</td>
      <td data-label="Period">02/01/2016 - 02/29/2016</td>
    </tr>
    <tr>
      <td scope="row" data-label="Acount">Visa - 3412</td>
      <td data-label="Due Date">02/01/2016</td>
      <td data-label="Amount">$842</td>
      <td data-label="Period">01/01/2016 - 01/31/2016</td>
    </tr>
  </tbody>
</table>

https://codepen.io/AllThingsSmitty/pen/MyqmdM