Articles From Chris Minnick
Filter Results
Cheat Sheet / Updated 03-22-2024
Generative AI coding tools can improve your productivity as a coder, remind you about syntax, and even help you with testing, debugging, refactoring, and documentation, but it's up to you to know how to use them correctly. Get ten prompt engineering tips that can make the difference between AI spitting out garbage spaghetti code and crafting elegant code that works. AI coding tools present unique challenges and hazards for software development teams, so check out some simple rules to make sure that generative AI doesn't tank your project. Then see what happened when ChatGPT was asked to list the top things human coders do that AI can never replace.
View Cheat SheetArticle / Updated 08-03-2023
Listen to the article:Download audio Mastodon is a decentralized social media platform that's made up of thousands of separate computers (also known as servers or instances) that have all agreed to speak the same language and share certain data. When you create your Mastodon account, you get a username, which will be tied to one of these servers. Each server in the network has its own personality — and some servers pride themselves in having no particular personality. Every server is free to join, although some may be closed to new accounts or may require that you get on a waiting list. The most difficult part of getting a Mastodon account is choosing which server to join. Fortunately, there's a Mastodon web page (shown in the image below) to help you sort through your options. You can sign up for Mastodon using the app or the website. However, signing up on the website — on your desktop, laptop, tablet, or phone — is easier than signing up with the app. Your very first step in getting Mastodon is to go to the Join Mastodon page. Then, click the "Get the App" link to use the app or click "Create Account" to use your web browser. Both the website and the app are free, and creating your account on one allows you to use all the features of both. If you click "Get the App," you'll be taken to a screen where you can choose to go to the Apple App Store (to download the iPhone app) or to Google Play (to download the Android app). Once you get to the app store, download and install the Mastodon app as you would with any app. Because Mastodon is based on a free and open standard, there are many apps to choose from to use Mastodon. Start with the official one, which is called Mastodon. Browsing your options When you visit the Join Mastodon page and click the "Create Account" button, you'll be taken to the Servers page, which is shown below. Many more Mastodon servers than the ones you see when you scroll down this page are available. However, the servers on joinmastodon.org follow certain rules known as the Mastodon Server Covenant, which is an agreement by the server's owner to work to keep the server free of hate speech, to back up their data daily, to have a person on call to deal with technical issues with the server, and to give users of the server at least three months’ notice before shutting down the server. Because these servers have agreed to the Server Covenant, they are seen as trustworthy, stable, and safe places to serve as your home in the Mastodon universe. Although you can't go wrong with any of the instances listed on the servers page, some will be a better fit for you than others — and that's what makes Mastodon so cool! Spend some time browsing through the different servers listed here. Note that you have several options for filtering the results — including by geographical region and topic (listed on the left side of the screen) and by legal structure, sign-up speed, and language (selected from drop-down lists at the top), as shown below. Once you've found a server or two that sound like places where you'd like to hang out and call your home base, the first potentially make-or-break characteristic of the server is the sign-up speed, which is how fast it will take for you to get an account. Understanding sign-up speed When you browse the list of servers, you'll see two types of buttons: "Apply for an Account" button and "Create Account." The "Create Account" button means that the server has instant signup: You can have a new account on that server in the amount of time it takes for you to choose a username and a password. Servers with an "Apply for an Account" button require that new accounts be approved by an administrator. This approval may take only a few minutes or a day. If you're super-excited to start using Mastodon, go with one of the servers that have the blue "Create Account" button. Don't worry too much about picking the perfect server. Choosing a server doesn't have to be permanent. You can move your account (and all of your followers!) to another server easily after you sign up. Reading the rules Regardless of whether you choose to apply for an account or go with a server that has instant account creation, check out the rules of your chosen server before you commit. To see a server's rules, first click the "Create Account" or "Apply for an Account" button to go to the server. Once on the server, you'll see a description of the server on the left, with the name of the server administrator and the number of users. Below the server information, click "Learn More" to read more about the server, including its code of conduct, which describes the guidelines for how users are expected to behave while using the server. Rather than having a complicated set of rules that try to make the greatest number of people happy and end up pleasing no one (such as what centralized platforms like Twitter and Facebook must do), each Mastodon server sets specific rules and the conduct expected from users. If you don't like the code of conduct on one server, check out other servers until you find one with a code of conduct more in keeping with your beliefs. Previewing a server When you sign up using a web browser, many of the servers listed at joinmastodon.org allow you to browse the content on the server before joining. If you click to the server and see posts, rather than immediately seeing a sign-up or login page, you've come to one of these. To see the content posted by the local users of the server, click the "Local" link on the right side of the page. The posts listed under "Local" are by people who would be your neighbors if you were to join this server. Are they talking about things you're interested in? If so, this may be the perfect server for you! Meeting the admin Another way to choose a server is to find out more about the person running it. Every server prominently displays the person in charge of keeping the server running and enforcing the server's rules. Click their profile from the server's home page or from the server's "About" page to read more about them and to see the things they're interested in and what they post. On Mastodon, the admin sets the tone for the server. If the admin seems like someone you'd like to hang out with, that's a good indication that you've found a home. Seeing why smaller is better A server might have just a handful of members to many thousands. Servers with a smaller number of users are vital to keeping the entire universe interesting and avoiding a monoculture. Smaller servers also tend to have stronger personalities than larger servers. And smaller servers are often less prone to slowing down because they're less likely to get a lot of traffic. Because every server allows access to the other servers, you have nothing to lose by going with a smaller one. In the same way that you're more likely to make friends in a small community group versus an international club with millions of members, joining a smaller Mastodon server makes you a bigger fish because the pond is smaller.
View ArticleCheat Sheet / Updated 04-14-2023
Programming with JavaScript isn't fundamentally about memorizing syntax or knowing every function available in a library or framework. If you know and understand the basics, you can look up everything else easily enough. However, if you learn a wide variety of tools, you'll understand how libraries and frameworks are constantly improving on what's been done before, and you'll gain an appreciation for why change is so important in the JavaScript world.
View Cheat SheetArticle / Updated 02-17-2023
Listen to the article:Download audio As Mastodon has become more popular, millions of people have flocked to it from Twitter. Perhaps you, too, first heard about Mastodon on Twitter. As a migrant from Twitter to Mastodon, you're in good company. Finding members of your Twitter flock on Mastodon isn't difficult, and it's a great way to get a head start with building a following. If someone considered you follow-worthy on Twitter, they will on Mastodon, too. Several tools have been created for finding Mastodon accounts of your Twitter followers. If you haven't deleted your Twitter account, you can use any (or all) of these tools. Using Twitodon to find friends on Mastodon One service to help you find your Twitter followers on Mastodon is Twitodon. This site works by linking to your Twitter account and your Mastodon account and comparing the list of accounts you follow on Twitter with accounts on Mastodon that have also used Twitodon. If matches are found, Twitodon will give you a file you can import into your Mastodon account. Follow these steps to use Twitodon: Make sure you're logged into both your Twitter account and your Mastodon account. Go to Twitodon and click the link under the "Get Started" header to log into your Twitter account. A window opens, asking you to authorize Twitodon to access your Twitter account. Click the button to authorize Twitodon. You return to Twitodon and its Step 1 has been crossed off. Enter your Mastodon server's address (including the https://) in the field under Twitodon's Step 2, as shown in Figure 1, and then click Sign In. For example, if your Mastodon account is on mastodon.social, you'd enter https://mastodon.social. A screen appears asking you to authorize Twitodon to access your Mastodon account. Click Authorize. You return to Twitodon and Step 2 has been crossed off. Watch the number of scanned users go up as Twitodon processes the list, as shown in Figure 2. We hope the number of matches found go up as well! Because Twitodon can find only users who have also used Twitodon, don't be surprised if it doesn't come back with many or any results. The good news is that as more people migrate from Twitter and use Twitodon, it will be able to make more matches! So, it may be a good idea to try Twitodon again every so often as long as you keep your Twitter account. When Twitodon finishes scanning, click the link in Twitodon's Step 3 to download a list of the matches that were found. Twitodon's Step 4 (revoking Twitodon's authorization to access your Twitter followers) is optional, and we're going to skip it. Doing so will make it easier to come back and check Twitodon periodically in the future. Click the link under Twitodon's Step 5 to go to the Import page on your Mastodon instance, or click Preferences, Import and Export, and then Import. You see a screen similar to the one in Figure 3. Under Import Type, choose Following List (it should be selected by default). Choose the Merge radio button (which should also be selected by default). Merging means that you'll still follow everyone you follow on Mastodon before you import the matches found by Twitodon. Click the Choose File button and locate the file you downloaded from Twitodon. The file is named new_mastodon_follows.csv and should be in your Downloads folder. Click the Upload button on Mastodon's Import page. After a moment, you'll see a message that your file was uploaded and will be processed. Depending on the size of the file you imported, it may take a few minutes or longer for the file to be processed and for the new users to be imported. After a few minutes, go to your profile page and check whether your following number has gone up. As you follow the people you followed on Twitter, they'll get notifications and some of them may decide to follow you back. Using Fedifinder Fedifinder can scan your entire Twitter account, including accounts you follow, accounts that follow you, and your Twitter lists to find Twitter users who list their fediverse address in their Twitter profiles. Because it scans your lists and followers and doesn't depend on matched users already having used it, Fedifinder is more likely to find results than other automated programs for finding other Mastodon users. Follow these steps to use Fedifinder: Make sure you're logged in to both Twitter and Mastodon. Go to Twitter and edit your Twitter profile to add your fediverse address in one of the following places: The description The location The website address You can add your Mastodon address also to a pinned Tweet. Your fediverse address is your Mastodon server name followed by a slash, followed by your Mastodon username. It's the same as the link to your profile page on your instance. For example: hachyderm.io/@chrisminnick. Go to Fedifinder again and click the Authorize Twitter button at the top of the screen. Follow the instructions to authorize Fedifinder to access your Twitter data. Fedifinder scans your Twitter account to find fediverse addresses and starts showing you the results, as shown in Figure 4. Scroll down the page and click the link next to any Twitter lists you follow, and then click the Scan Followers link. After all the scans have finished, click the Export CSV with Found Handles link. CSV, short for comma-separated values, is a way of storing lists of data in text files so they can be imported into other systems. Go to the Import page on your Mastodon instance (click Preferences, Import and Export, Import) and import the resulting file (fedifinder_account.csv) in the same way you imported the file from Twitodon. Inviting friends and family If you have a fairly large Twitter following and follow a large number of Twitter accounts, you may have acquired some new followers and follows from using Twitodon and Fedifinder. But not everyone you want to follow is on both Mastodon and Twitter. To get more people to join you on Mastodon, you need to invite them. Mastodon makes inviting people to join your Mastodon server easy. Plus, when you use Mastodon's invite feature to invite people, signing up will be easier for them than it was for you because the link you give them will take them directly to the same local server you use. If your server allows users to create invitations, you can get an invitation link by clicking Preferences and then Invite People. You'll see the Invite People page, which is shown in Figure 5. The Invite People page allows you to create individual links, limited-use links, and links that expire. Unless you want to have a limited number of followers or you want to be able to track who uses which links, the best way to use Invite People is with the following settings: Set Max Number of Uses to No Limit Set Expire After to Never Select the Invite to Follow Your Account check box Once you've configured these settings, click the Generate Invite Link button. A text box with an invitation address appears, as shown in Figure 6. Tap or click the Copy button to copy this link. Here are a few ideas for how you can use your Invite link: Paste it into a post on Facebook. Put it in your profile on Twitter. Paste it into your Instagram profile. Email it to your friends and family and tell them to join you on Mastodon. Send it in a text message. Add it to a website you own. When someone follows the link on their phone, tablet, or computer, they'll see the same sign up page you saw when you first signed up for Mastodon. Plus, when someone signs up using your link, you'll find out about it, the number of uses next to your invite link will go up, and you'll gain a follower!
View ArticleArticle / Updated 02-16-2023
Listen to the article:Download audio The chaos surrounding Twitter after Elon Musk acquired it in October 2022 led many Twitter users to begin checking out other social media platforms, including Mastodon. Here, we'll go over some of the major differences between the two platforms. The first thing to know about Mastodon is that it isn’t just one site, like Twitter.com and Facebook.com. Mastodon is made up of a galaxy of sites, and the first choice you’ll make when you decide to create an account is what star (or instance) in this galaxy of sites to call home. Each of these sites runs the Mastodon software (the common platform). Once you have a home on a site running the Mastodon software, you can connect with people on other sites running Mastodon. Many people arrive on Twitter looking to raise their public profile, gain millions of followers, and go viral. Certainly some people have become media pundits and celebrities by way of their Twitter posts. On Mastodon, however, being sociable, informative, and authentic is more important. A Mastodon instance is better thought of as a neighborhood rather than a stage. You don’t have to be smart-alecky to be respected. In addition, before getting an account on a Mastodon instance, you sign on to a code of conduct. Although the code of conduct can go into detail regarding what is and isn't allowed, the code is often simply a lengthy version of “while you’re on here, be nice.” Mastodon is a home, not a single site If you want to tweet, you go to Twitter.com, get an account, agree to the terms of service (whether you read all that legalese or not), and start tweeting. Twitter may not ask much of you as a user, but you pay a price. You have no stake in Twitter as a company, except as an unpaid content contributor. Twitter polls run by the CEO aren't binding, and wouldn't be, even if a majority of participants were stockholders. Every Mastodon server instance is an island to itself but interconnected. Instance administrators and moderators are not gods and can't make any decisions beyond that instance. That’s true even for founder Eugen Rochko. The vast majority of Mastodon sites seek to be safe and friendly spaces for all kinds of users. You should feel like you’re at home here. Mastodon is built to serve its community Mastodon is not driven by its financial bottom line nor the whims of venture capitalists, Wall Street traders, and hedge fund managers. It's driven to serve its users and the community. If the founder or his heirs were to sell the mastodon.social site, where Mastodon was born, each user could easily move to another Mastodon instance, taking their posts and followers with them. If you’ve found a home with a group of admins and moderators that serve you and the community at large, consider helping to keep the servers (and the community) running with a financial contribution that fits your budget. Algorithms aren't allowed on Mastodon Twitter started out as a place where you read the tweets of the people you followed in reverse-chronological order (as you do in blogs). But as the service grew, Twitter developed algorithms to figure out what you liked and shared on the service. The purpose of the algorithm was to keep you scrolling through your feed. You got what the algorithm thought you wanted, but you also saw more ads as the session continued. More eyeballs on ads, more money for Twitter. As politicians and politically oriented people found a way to get followers, raise money, and gain influence on the service, ordinary users found themselves in a filter bubble, where they saw only things with which they agreed. Debate, where it existed at all, became toxic. Misinformation flourished. Some people started calling Twitter a hellscape because of all the angry tweets that the algorithm promoted into people’s feeds. No Twitter user ever got to opt-out of the algorithm’s role in managing their feeds. There was never a vote among users to implement the algorithm when it was first developed. Programmers from outside the company couldn’t review the algorithm to determine its effect on people’s emotions. In contrast, Mastodon displays every post from every user and hashtag you follow. You may still spend hours scrolling through interesting posts by fascinating people, but at least you know that Mastodon won’t try to manipulate you to stay longer on the platform. Users aren't tracked on Mastodon The same forces (sometimes called surveillance capitalism) that created algorithms also created the cookie, that tiny slice of code that lives in your browser and tracks your movements across the platform and elsewhere. The cookie’s owner aims to understand the things you’re interested in or curious about — the better to sell your social graph to advertisers. The Mastodon focus on privacy actively discourages cookies. Nearly every instance offers strict rules on such behavior, and should an instance permit it, that instance would likely be blocked by most other Mastodon instances. Don’t bet on this changing anytime soon. Ads aren't acceptable (yet) on Mastodon The initial burst of enthusiasm for Mastodon came when Twitter appeared to be placing its financial stability on selling more advertising on the platform. The Great Mastodon Migration of 2022, which came next, was made up of users and advertisers who didn’t want to be associated with Twitter's new owner. On Mastodon, most codes of conduct discourage excessive advertising, and what’s excessive has mostly counted in single digits. The exceptions are the online equivalent of yard sales, art shows, community theater, and musical performances. The Mastodon focus on community-building frowns on personal branding at least as much as on corporate branding. However, businesses aren't banned, and if you’re in business, you can post about it all you want. What won’t fly are targeted ads based on trackers and algorithms, as noted previously. Mastodon isn’t perfect, but its ideals are high. Welcome to the fediverse! The fediverse is a collection of websites and social networks that, in some ways, looks back fondly on the early days of the World Wide Web. When Sir Tim Berners-Lee created the web, he envisioned it as a collaboration tool, with sites offering read-write access to any visitor. Aside from wiki sites (such as Wikipedia) and blogs that accept reader comments, today’s web is largely a space for one-way communication. Mastodon encourages its users to collaborate by putting the focus on conversation and discussion. It’s easy to participate in a conversation by selecting the post's reply icon. The Fediverse expands that idea beyond just Mastodon into other services. The fediverse, which is a combination of federated and universe, got its name for the federated connections between independent websites on the social web. The foundation of the fediverse, and Mastodon as well, is the ActivityPub protocol, recognized as a web standard by the World Wide Web Consortium (W3C). Developers use the standard to power a variety of federated alternatives for organizing events, sharing music, and just hanging out. The boring, technical way to describe the ActivityPub standard is that it “provides a client-to-server application programming interface (API) for creating, updating and deleting content, as well as a federated server to server API for delivering notifications and subscribing to content.” Mastodon first used a protocol called OStatus, an open standard that enables microblogging, but switched to ActivityPub in 2017. For the last decade or so, the IndieWeb movement has been building some of the social web standards that power Mastodon, especially the ActivityPub protocol, but for individual websites. IndieWeb focuses on your ability to control your content and connect with the people you want to connect with, with no one using your stuff to get others to sell you things you may not want. Do not confuse fediverse with metaverse! The metaverse started as a creation in the mind of speculative fiction author Neal Stephenson in his fantastic novel Snow Crash. In the novel, the metaverse served as the escape hatch from the dystopia in which most people lived, where the only jobs were in high tech and high-speed pizza delivery. The dystopia was the society. Today, the metaverse is a virtual reality that Facebook (excuse us, Meta) billionaire Mark Zuckerberg wants to use to make even more money. The fediverse is a much more pleasant place, where the users rule. And if profits are even a consideration, they come after the people who participate. Understanding federation When you’re starting out with Mastodon, wrapping your head around the idea of a federation can be maddening. Not to overwhelm you with community metaphors, but think about the following facets of neighborhoods: Life might be pretty much the same from neighborhood to neighborhood, but some places have different social rules. Violating those rules can get you in trouble. In some neighborhoods, you must live there for many years before you can even call yourself a resident! Although your neighborhood might have regular elections for city council members and other leaders, you might also have a person active in the community who is so respected that they’re called the mayor of the neighborhood. If you have an active neighborhood association, they probably have events to raise money for various programs to improve life in the neighborhood. While the city government pays for a lot of things (and usually has taxing power), neighborhood associations often pay for things such as flowers in common areas. You can change your residence from one neighborhood to another without getting permission from the city or the neighborhoods involved (condominium association boards notwithstanding). All this is true also in the virtual world of Mastodon: Every Mastodon instance (neighborhood) has a code of conduct that you have to agree to before you join (move in). Violating the code of conduct can get you in trouble (a suspension or worse). Regardless of whether your instance has a governing board, the administrator is definitely the permanent mayor, in charge of keeping things going. While your instance administration can’t tax you (yet) to keep the servers running, you do have an obligation to help out if you can. As the mother instance, https://mastodon.social helps other instances financially, but each independent instance has to keep the lights on. Aside from a disciplinary situation, it’s easy to change your Mastodon neighborhood — and bring all your friends with you. If you ever need to move your account to another instance, there's a Mastodon page with instructions.
View ArticleCheat Sheet / Updated 02-16-2023
Listen to the article:Download audio Even though thousands of people join Mastodon every day, the number-one concern of new users is that they can't make the shift over from Twitter entirely because many of the people they follow on Twitter haven't set up a Mastodon account yet. Here, you discover some of the best ways to start meeting and engaging with new people on Mastodon. Another concern of new Mastodon users is that it's different from using other social media sites such as Twitter, Facebook, or Instagram. At first, these differences may seem difficult to adapt to. But with the tips covered here, using Mastodon will soon become second nature.
View Cheat SheetArticle / Updated 08-11-2022
Lists are powerful tools for grouping similar elements, and lists give visitors to your site an easy way to zoom in on groups of information. Just about anything fits in a list, from sets of instructions to collections of links. Definition lists group terms and definitions into a single list and require three elements to complete the list: : Holds the list definitions (dl = definition list) : Defines a term in the list (dt = definition term) : Defines a definition for a term (dd = definition list definition) You can have as many terms (defined by ) in a list () as you need. Each term can have one or more definitions (defined by ). Creating a definition list with two items requires tags and content in the following order: First term name Content for the definition of the first item Second term name Content for the definition of the second item The following definition list includes three terms, one of which has two definitions: <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Definition Lists</title> </head> <body> <h1>Markup Language Definitions</h1> <dl> <dt>SGML</dt> <dd>The Standard Generalized Markup Language</dd> <dt>HTML</dt> <dd>The Hypertext Markup Language</dd> <dd>The markup language you use to create web pages.</dd> <dt>XML</dt> <dd>The Extensible Markup Language</dd> </dl> </body> </html> The figure shows how a browser displays this HTML. If you think items in a list are too close together, you can use CSS styles to carefully control all aspects of list appearance. Note that definition lists often display differently inside different browsers, and they aren’t always handled the same by search engines or text-to-speech translators. About.com has a nice discussion of definition lists on their Web Design / HTML page. Alas, this means that definition lists may not be the best choice of formatting for lists you create (even lists of definitions). For a more detailed discussion, see the excellent coverage of this topic on Max Design.
View ArticleArticle / Updated 08-02-2022
Two big categories of strategies have been employed over the years to support web design for mobile devices: graceful degradation and progressive enhancement. Much of the web is currently nearly unusable on mobile devices because it was designed for desktop browsers and doesn't adapt well to small screens. Mobile web users are often forced to zoom, scroll, pinch, squint, and make their fingers as small as possible to use the majority of websites designed more than a couple years ago. Graceful degradation web design strategy for mobile devices The idea behind graceful degradation is to design your website primarily for desktop users, but to also design it in such a way that features of the desktop site that won't work or fit on mobile devices will still be usable — if not pretty or as functional — on mobile devices. Graceful degradation was a good design philosophy in the days before smartphones with full-featured browsers existed. However, graceful degradation does have major problems. Most importantly, graceful degradation forces the user to download your whole website, only to be shown a degraded version of it. On mobile devices, which often have limited bandwidth, this is not a good thing. Progressive enhancement web design strategy for mobile devices As a result of graceful degradation's limitations, a new strategy called progressive enhancement has become popular. Progressive enhancement starts with the very most basic website and adds on features depending on what the user's browser supports. Progressive enhancement enables websites to be usable even when using a very basic mobile phone. The mobile browser doesn't need to download a lot of CSS and JavaScript code (for example) that it doesn't know what to do with. One way to visualize progressive enhancement is as a system that adds layers onto a website depending on the size of the browser or the features the browser supports. Here's a simple example of how two style sheet links can be used to enhance a mobile webpage for larger browsers: <link rel="stylesheet" type="text/css" href="style.css" media="screen, handheld" /> <link rel="stylesheet" type="text/css" href="enhanced.css" media="screen and (min-width: 800px)" /> The first link includes style.css for any screen or handheld device. In this case, style.css contains styles that are optimized for a mobile device. The second link is for a style sheet called enhanced.css. If you look at the media attribute for this link, you'll notice that it has a min-width condition. The enhanced.css file will only be included if the device is larger than 800px. Inside enhanced.css, the web designer can override properties from the style.css style sheet to make the browser scale up for larger browser widths. Mobile first design solves the browser size issue Mobile first is a design philosophy that employs the ideas of progressive enhancement to build mobile websites first and then enhance them for desktop. The great thing about mobile first design is that when you build the mobile site first, as opposed to the other way around, you get a functional desktop site for free! Think about all the websites you've seen that don't fit in mobile browsers. Now, imagine visiting a mobile website with a desktop computer. A website that is optimized for a small screen will always work on a desktop browser — even if it does end up not filling the entire browser window.
View ArticleArticle / Updated 08-02-2022
HTML5 brings some pretty amazing new functionality to JavaScript web pages, and the HTML 5 APIs are rapidly giving web browsers access to new universes of data and making installable computer applications a thing of the past. However, not every browser is on board with the future yet. Or, not every browser can agree on what that future should be. As a result, it’s quite possible, and quite common to want to use a particular HTML tag or API and find that it just doesn’t work in some browsers. Fortunately, some ingenious folks have come up with a strategy, called polyfills, for implementing features in browsers that don’t yet support them. Modernizr is a JavaScript library that detects whether a browser supports features of HTML5 and CSS3. A typical way to use a polyfill is to first detect whether the user’s browser supports the feature in question, using Modernizr, and then use the polyfill if not. To install Modernizr, select the particular tests that you'll be using in your web application, and build a custom version of the library that you can then import into your website using the script element. Modernizr uses a simple syntax to select between different paths based on whether a user’s browser supports a feature. For example, here’s a Modernizr test that checks for geolocation support: Modernizr.load({ test: Modernizr.geolocation, yep : 'geo.js', nope: 'geo-polyfill.js' }); A common case in which you would want to use a polyfill is with video. The HTML5 video element allows browsers to play videos without using any plugins. However, different browsers require different video formats, and some older browsers don’t support the video element at all. In order to smooth over these differences, you can include and use a JavaScript polyfill called MediaElement.js. To use it, you can simply download and include the appropriate JavaScript and CSS files and include the following script elements in the head of your document: <script src="jquery.js"></script> <script src="mediaelement-and-player.min.js"></script> <link rel="stylesheet" href="mediaelementplayer.css" /> Then, using just a single video file in any browser can be as simple as just using the video element and specifying a single .mp4 source file. <video src="myvideo.mp4" width="320" height="240"></video> If the browser doesn’t support the video element or this format, a Flash video player will be used as a backup. Polyfills exist for nearly every new HTML5 feature. A complete list of polyfills is maintained by Modernizr.
View ArticleCheat Sheet / Updated 06-30-2022
Coding is equal parts vocabulary, logic, and syntax. Coding may at first seem intimidating, but with practice, though, it's easy to get comfortable with its terminology, concepts, and structure. Understanding coding is not unlike learning a new language: Use it often enough and you'll find yourself able to speak, think, and write in code. Still, it's natural for beginners to have questions. There are many coding resources available to you, both on- and off-line. Ask around and you'll find you're not alone — many other people are learning. After all, coding is a never-ending education. Master one facet or another and a new one opens in front of you.
View Cheat Sheet