How To Read Ebooks and Audiobooks for Free

Daily Herald:

One of the worst-kept secrets is that your local library often has way more to offer than a traditional book or two. E-books and audiobooks are as much a part of the catalog these days.

And Libby is an app from OverDrive — a company that works with libraries around the country to show off their e-books and audiobooks on offer.

Users will need a valid library card from a participating system to use Libby. But if you meet those criteria, then the app makes it a snap to check out materials or place holds on the titles you want. You can read or listen to them right in the app.

It can also send your library books to a Kindle.

You will need to join your local library to use it. But it’s free and a better app than Audible. I’m a huge fan of this app.

https://meet.libbyapp.com

How To Blur Popup Background in Ionic/Angular

How To Blur Popup Background in Ionic/Angular using manual method:

To achieve this in Ionic 1, you need to set the main div’s class (that is displayed in the background of your popup) to use the blur css class .

CSS:

// css file 

.blur{
  -webkit-filter: blur(2px);
  -moz-filter: blur(2px);
  -o-filter: blur(2px);
  -ms-filter: blur(2px);
  filter: blur(2px);
}

HTML:

//In your html set the main div of your app to use a dynamic class
 
<div ng-class="blurClass"></div>

JS Controller:


//In JS file set the blur variable to the blur class
 
$scope.blurClass = "blur";

// when done just set the blur to false

$scope.blurClass = false;

How To Open $ionicPopover Popup from Controller

How To Open $ionicPopover from Controller programmatically without a mouse click event:


var self = this; // store reference to 'this' controller object

this.openCustomPopover = function ($event) {

        $event = document.getElementsById('myElementID'); // html element ID 

        $ionicPopover.fromTemplateUrl('popovers/myhtmlpopover.html', {
                scope: $scope
            }).then(function (popover) {
                console.log('in the popover then function');
                self.popover = popover;
                self.popover.show($event);
            });
        }

You can call this function from your controller without a true click event, by faking the $event object.

How to Display and Format Code Snippets on WordPress

How to Display and Format Code Snippets on WordPress ?

What I use is Pretty print, and it’s very simple to setup.

1. Include this script in your header run_prettify.js

2. Start your code with the pre tag

<pre class="prettyprint">
class Voila {
public:
  // Voila
  static const string VOILA = "Voila";

  // will not interfere with embedded tags.
}
</pre>

More information at https://github.com/google/code-prettify

How to Dynamically Load Dark Mode CSS with JavaScript

How to Dynamically Load Dark Mode CSS in your Website or WebApp (Ionic, React, or Angular):

1. Create the two separete css files, one for dark colors and one for bright
2. Upload those to your server to css folder
3. Use the script example below to load the appropriate css file based on the hours in the day.


function loadcssfile(filename, filetype){
    if (filetype=="css"){ //check filename is an external CSS file
        var fileref=document.createElement("link");
        fileref.setAttribute("rel", "stylesheet");
        fileref.setAttribute("type", "text/css");
        fileref.setAttribute("href", filename);
    }
    if (typeof fileref!="undefined")
        document.getElementsByTagName("head")[0].appendChild(fileref);
}

var date = new Date();

 if (date.getHours() >= 19 || date.getHours() <= 7) // after 7pm before 7am
	loadcssfile("../css/darkmode.css", "css");
 else
	loadcssfile("../css/lightmode.css", "css");

Don't blind your readers at night -_-

If you want to incorporate sunset and sunrise you can look into Suncal library, but you will have to request user's location which is always rude and not recommended.

How to Fix Your Cast Iron Skillet

Follow these simple steps to restore your iron skillet:

Iron Skillet
Credit: Tsuji/Getty

1. Remove all the rust (duh)

Use fine steel wool to remove the rust. Don’t stop until the skillet returns to raw cast iron.

2. Wash the skillet

Wash the cast iron with warm water and dish soap. Scrub with bristle brush, or mesh sponge.

3. Dry the skillet

Dry the cast iron with a clean towel or paper towels.

4. Cover the pan with a coating of oil

Apply a small amount of cooking oil of your choice to the entire pan, handle included.

5. Bake in the oven at 350°F

Place the cast iron on the top rack of your oven, upside down. Place a sheet of aluminum foil, a pan, or baking sheet on the bottom rack to catch any oil. Bake the pan for one hour.

6. Let the pan cool off

Let cast iron cool before taking it for a spin.

And that is all! You are ready to use your brand new cast iron skillet!

Good luck.

How to Find Visible HTML Element by class in JavaScript

How to Find Visible HTML Element by class in JavaScript?

We can use the same logic jQuery uses with this code:

element.offsetWidth > 0 && element.offsetHeight > 0;

You can simply go through the list of your class elements to find the one currently displayed.

for (var i = 0; i < document.getElementsByClassName('myclass').length; i++) 
{
   if (document.getElementsByClassName('myclass')[i].offsetWidth > 0 &&
       document.getElementsByClassName('myclass')[i].offsetHeight > 0) 
       {
           //found the visible element of class 'myclass'
            break;
       }
}