Create an inline website editor using contenteditable

Let’s say you have a website and you’re tired of making constant updates to some portion of oft-changing content, e.g. a conference agenda. It would be nice to offload this tedious work to a content owner who so often makes typos. But this content owner is non-technical and is a visual person. They need a WYSIWYG editor that would allow them to make changes directly on what it is that they want to edit, not directly in a database or something cryptic like a JSON file.

HTML5 supports the contenteditable attribute which makes any element editable. In the screenshot below, on a part of the byline is made editable.

Simple add the attribute “contenteditable=true” to the tag that wraps the text you want to make editable.

<p>Last Edited by <span id="author" contenteditable="true">Monty Shokeen</span>
</p>

When the content owner clicks on the text to editor, a black outline appears making it look like a form field.

The contenteditable attribute can be added to as many HTML elements as you want. Here is a live example showing three different editable fields with changes saved to local storage. Here’s an example showing how you can save the changes in JSON format and post it to a URL endpoint using AJAX or Fetch.

editor.js – a web-based WYSIWYG editor that outputs JSON

Many web developers are familiar with online editors like TinyCME. If you’ve edited a blog post in WordPress using the classic editor, then you know what I mean.

The problem with this type of editor is it’s too easy to accidentally output garbage HTML. WordPress has switched to offering a block style editor.

If you need to create a similar editor for your web project, editor.js offers inline block-style editing and it outputs clean data in json format.

Here’s a screenshot of example JSON output which can then be used with

This JSON data can then be used with a templating language like Handlebars to build web pages.

Need Icons For a Website? Use FontAwesome!

Icons make a big difference in the look of a website. When placed beside text links, they make the links stand out. They can be used to replace text links, especially on mobile. They accompany text to make boring, text heavy pages easier to read. But, finding icons or creating them can be difficult. FontAwesome solves this by offering thousands of icons that are easily searchable. If I search for car, here’s what I see.

To use an icon, e.g. of a car, just paste this HTML code.

<script src="https://kit.fontawesome.com/8758af3809.js" crossorigin="anonymous"></script>

<i class="fas fa-car"></i>

Here’s a demo.

Grilled Corn Using Ninja Foodi Grill

So, I tried making grilled corn using the Ninja Foodi Grill and surprisingly, it came out really good!

Here’s the recipe.

Ingredients

  • Corn ears (make sure the kernels are big so you’ve got some meat to bite in to)
  • Salt
  • Pepper
  • Canola oil
  • Butter

Instructions

  1. Remove the husk (outer layers of the corn)
  2. Massage the kernels with canola oil
  3. Sprinkle salt and pepper
  4. Turn on Ninja Foodi Grill, click Grill button to Max setting, set time to 12 minutes, let preheat, wait till it says “Add food”, then put in the corn
  5. Set a timer for 6 minutes then turn the corn over
  6. When done, massage butter over the corn or melt butter in the microwave and baste the corn with the liquid butter

Prevent weeds from growing anywhere in your yard

As I’ve said before, weeds are notorious for finding ways of growing through weed fabric and along yard edges.

Middle of yard

To combat weeds from popping up in the middle of your landscape, lay cement board everywhere. Cement board is porous so water can still drain through it. For the areas between the cement boards, weeds will grow. To prevent this from happening, cut pond liner and place it where the cement board gaps are. Pond liner is very strong, UV-resistant, and almost impossible to tear. Traditional weed fabric may be marketed with the claim that it can prevent weeds but it can’t. Weeds still manage to come through. Plus, if you use weed fabric along edges where it’s exposed, it can degrade and easily tear as shown in the picture below.

Now I have to replace that weed fabric with pond liner like I did along a different fence.

Edges of yard

For edges, you can screw pressure-treated 2x4s to the cement edges using special screws and a drill bit for concrete. Just make sure to drill using the hammer drill mode.

If there is no room to drill a screw into the concrete, e.g. if the edge is near a fence, then you can drill 1/2-inch holes in the 2×4 using a 1/2″ spade bit and drive 12-inch long, 3/8-inch galvanized nails through the holes into the ground.

Cut some pond liner and staple it to the 2x4s. Don’t use traditional weed fabric. It will eventually fail and rip and weeds will come through it.

Hammer the large nails through the 2x4s and the pond liner into the ground along the edge of the concrete as shown below.

Allow some of the pond liner to extend beyond the end of the 2×4 so the next 2×4’s pond liner will overlap the first one and prevent weeds from growing in between the 2x4s.

Since 2x4s may not be perfectly straight, you can push them against the concrete edge using a clamp.

If the other side is a wood fence, you can simply staple some pond liner to the fence. In the picture below, the space between the concrete and the fence was narrow. I left a gap between the pond liner for drainage.

Easily cut cement board using a reciprocating saw. You can also use a utility knife or the WEN Electric Fiber Cement and Siding Shear, Variable Speed (3670).

In this case, I placed the cement board over the gaps between the pond liner to prevent weeds from growing along the gap.

You can then put rocks like I did pictured below.

There will still be a small gap between the concrete edge and the 2x4s. Fill that cap with concrete control joint sealant. I like Sikaflex Self-Leveling Sealant. Learn more.

For the rocks, I used ¾-inch ginger rocks / Sonoma gold rocks.

Shakshouka / Menemen Recipe

Moroccan Shakshouka and Turkish Menemen are very similar. Here’s my version of these dishes.

Ingredients

  • 3 eggs
  • 1 8oz can of fire-roasted diced tomatoes (Target / FoodMaxx)
  • 2/3 cup frozen diced onions (Smart n Final)
  • 1//4 cup cilantro for garnish
  • 2 tbsp wet minced garlic
  • 10 tbsp olive oil
  • Smoked paprika (not regular paprika)
  • Salt and pepper
  • 2 tbsp tomato paste (optional)
  • Pita bread

Instructions

  1. Pour olive oil in medium 10″ pan on medium-high heat
  2. Fry onions and garlic until slight brown
  3. Pour in diced tomatoes and sprinkle in smoked paprika, salt and pepper to taste (optionally, add tomato paste)
  4. When mixture is not too runny, make 3 deep dimples in the pan and crack each egg into them
  5. Cover and poach on low heat until egg white changes from translucent to white. Turn off heat so that egg yolk is still runny.
  6. Garnish with cilantro
  7. Cut some pita bread in quarters and warm for 15 seconds in microwave
  8. Eat
Fry diced tomatoes and garlic in olive oil
Cook fire-roasted tomatoes with smoked paprika, salt and pepper and optionally tomato paste
Make dimple in mixture
Crack eggs into dimples without breaking yolk
Cover and poach eggs on low heat until egg whites are white, not transparent
Like this
Garnish with cilantro and warm up pita quarters
Eat directly from pan

Steak Recipe Using Ninja Foodi Smart Grill

So, I just got the Ninja Foodi Smart Indoor Grill which doubles as an air fryer and mini oven. I have another cheaper indoor grill but tends to produce smoke and always triggers my smoke sensor. So far, though the Ninja grill is larger, it hasn’t emitted any smoke nor triggered my smoke sensor and produces better grill results.

Here’s how to make steak using it.

Ingredients for Marinade

Preparation

  1. Get your steak (minimum 1″ thick and preferably from Costco).
  2. Put that steak in a ziploc bag.
  3. Mix water and sauce and pour into the ziploc bag.
  4. Zip the bag and turn a few times and let marinate for 1 to 8 hours.

Cooking Instructions

  1. Insert thermometer into middle of side of steak such that the tip is at the center of the thickest part.
  2. Turn on the Ninja grill by pushing the grill button.
  3. Click the left up/down arrows to choose a doneness level. I like medium rare.
  4. Push the thermometer / preset button to start the preheat phase
  5. Sprinkle salt on both sides of the meat.
  6. When preheating is done, it will beep and tell you to insert the steak. Do so.
  7. Sometime later, it will beep and tell you to flip the steak. Do so, preferably using silicone-tipped tongs.
  8. Sometime later, it will be done and tell you to get the steak out. Do so and wait 5 minutes before enjoying.

Grill Vegetables (optional)

To complement the steak, you can grill some vegetables in the Ninja grill also. Here are the veggies that grill well.

  • Asparagus
  • Zucchini
  • Tomatoes
  • Onions
  • Bell pepper
  • Jalapeno peppers
  • Tomatillo peppers
  • Corn

Instructions

  1. Cut vegetable in half or in slices.
  2. Remove spicy seeds from peppers.
  3. Slather with / baste in oil.
  4. Sprinkle coarse salt and pepper.
  5. Turn on Ninja grill
  6. Push grill button
  7. Push right up/down to set the time to 6 minutes
  8. Push thermometer / preset button twice to skip preheating
  9. Put veggies in grill
  10. The grill will beep when done.

Tips for Visiting Istanbul

Here’s a custom Google Map with markers of interesting places to visit in Istanbul.

Food

Baklava

Karaköy Güllüoğlu
Karaköy, Rıhtım Cad. Katlı Otopark Altı No: 3-4 Istanbul / Turkey T: +90 212 293 09 10 Google Maps

Carrot Shaped Baklava with Ice Cream

Iskendar Kabab

Sırevi
Alemdar, 34122 Fatih/İstanbul, Turkey Google Maps

Beef Pide

Guvenc Konyali

Ankara Cad, Hocapaşa Hamamı Sk. No: 4, 34110 Fatih, Turkey Google Maps

Tours

Aya Sofia and Blue Mosque Walking Tour

Grand Bazaar Walking Tour

Galata Bridge – Karakoy Walking Tour

Istiklal Cadessi Walking Tour

Süleymaniye Mosque to Spice Market Walking Tour

Quickly Create Photo Slideshow Video

This tutorial uses Corel VideoStudio Pro.

1. Add photos to project

Sort the photos as desired, usually by date, so they appear in chronological order.

2. Select and drag photos to video track

All photos will be added to the video track

3. Change duration of each photo

If the duration of each photo is too short or long, select all photos, right click and click on “Change Photo Duration …”. This will change the duration for each and all photos.

4. Add a transition effect

Choose a transition (a simple “crossfade” is the best”), right click and click on “Apply current effect to video track”.

This will result in the transition being applied to all photos.

5. Add Pan and Zoom effect

Select all photos, right click and click on “Auto Pan & Zoom”.

6. Drag audio file to music track

You can find some background music from Sound Cloud.

7. Add intro slide

Click “Instant Project” icon, click on “Beginning”, choose a template, right click and click on “Add at the beginning”.

8. Edit intro slide

Since the intro slide is a template, you will see placeholder content.

Drag a photo to the placeholder clip and hold “Ctrl” to replace the clip. This will cause the photo to be formatted to fit the template.

Double-click the text clip to edit the text of the intro template.

9. Add end slide

This process is the same as for adding the intro slide but click on “Add at the end” instead.

10. Add text to some photos

Click “Title” and then pick a title template. The one with a semi-transparent background is good. Drag it to the Title track where you want the text to appear.

11. Change text and background color

This title template animates the text.

Convert it to a simple fade in and out by clicking on the “Attribute” tab in the Options Panel for the title, click on “Attribute” tab, click on “Animation”, and disable animation by unchecking the “Apply” checkbox.

The background of the text is too light so let’s darken that semi-transparent bar. Double-click on the title clip and in the Options Panel, click the “Edit” tab, and click on the black color in the Text Backdrop context menu as shown in the screenshot below.

Double-click on the title clip again and edit the text.

12. Add more text

Copy and paste the text clip to other photo clips and edit the text.

13. Render video

Click the “Share” tab, choose a setting, and click “Start” button.

Batch Search and Replace in VisualStudio Code

Have you ever needed to do search and replace multiple times against the same file or set of files. If so, the Batch Replacer extension for VisualStudio Code makes this very simple.

  1. Open a folder or file in VisualStudio Code
  2. Create a new file (no need to save it) and enter some search and replace instructions, e.g.

In the example above, I want 3 different replacements done in the order shown and I only want the replacements done to a specific file. The “in” command is followed by the path of the file relative to the root of the workspace open in VS Code. If the file is open, you can get it by right clicking on its tab and selecting “Copy relative path”.

3. Execute the replacer script

To run the batch replacements, you active tab must be the tab containing your replacement instructions. Then, hit CTRL+SHIFT+P -> Batch Replace. A status window will appear in the bottom right corner telling you how many files have been modified. If you want to batch replace across all files in your workspace, don’t include the “in” instruction.