Skip to content

Instantly share code, notes, and snippets.

View Anna-Myzukina's full-sized avatar
💭
if you NEVER try } YOU`LL never KNOW

Anna Muzykina Anna-Myzukina

💭
if you NEVER try } YOU`LL never KNOW
View GitHub Profile
/**Using the Test Method
Regular expressions are used in programming languages to match parts of strings. You create patterns to help you do that matching.
If you want to find the word "the" in the string "The dog chased the cat", you could use the following regular expression: /the/. Notice that quote marks are not required within the regular expression.
JavaScript has multiple ways to use regexes. One way to test a regex is using the .test() method. The .test() method takes the regex, applies it to a string (which is placed inside the parentheses), and returns true or false if your pattern finds something or not.
let testStr = "freeCodeCamp";
let testRegex = /Code/;
testRegex.test(testStr);
@Anna-Myzukina
Anna-Myzukina / SetDefaultParametersForYourFunctions.js
Last active October 27, 2021 13:07
Introduction-to-the-ES6-Challenges
/**Set Default Parameters for Your Functions
In order to help us create more flexible functions, ES6 introduces default parameters for functions.
Check out this code:
function greeting(name = "Anonymous") {
return "Hello " + name;
}
console.log(greeting("John")); // Hello John
console.log(greeting()); // Hello Anonymous
/**Access Array Data with Indexes
We can access the data inside arrays using indexes.
Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use zero-based indexing, so the first element in an array is element 0.
Example
var array = [50,60,70];
array[0]; // equals 50
var data = array[1]; // equals 60
<!--Add Columns with grid-template-columns
Simply creating a grid element doesn't get you very far. You need to define the structure of the grid as well. To add some columns to the grid, use the grid-template-columns property on a grid container as demonstrated below:
.container {
display: grid;
grid-template-columns: 50px 50px;
}
This will give your grid two columns that are 50px wide each.
The number of parameters given to the grid-template-columns property indicates the number of columns in the grid, and the value of each parameter indicates the width of each column.
<!--Add Flex Superpowers to the Tweet Embed
To the right is the tweet embed that will be used as the practical example. Some of the elements would look better with a different layout. The last challenge demonstrated display: flex. Here you'll add it to several components in the tweet embed to start adjusting their positioning.
Add the CSS property display: flex to all of the following items - note that the selectors are already set up in the CSS:
header, the header's .profile-name, the header's .follow-btn, the header's h3 and h4, the footer, and the footer's .stats.-->
<style>
body {
font-family: Arial, sans-serif;
@Anna-Myzukina
Anna-Myzukina / CreateAMediaQuery.html
Last active November 27, 2018 12:25
ResponsiveWebDesignPrinciples
<!--Responsive Web Design Principles: Create a Media Query
Media Queries are a new technique introduced in CSS3 that change the presentation of content based on different viewport sizes. The viewport is a user's visible area of a web page, and is different depending on the device used to access the site.
Media Queries consist of a media type, and if that media type matches the type of device the document is displayed on, the styles are applied. You can have as many selectors and styles inside your media query as you want.
Here's an example of a media query that returns the content when the device's width is less than or equal to 100px:
@media (max-width: 100px) { /* CSS Rules */ }
and the following media query returns the content when the device's height is more than or equal to 350px:
<!--Add a Text Alternative to Images for Visually Impaired Accessibility
It's likely you've seen an alt attribute on an img tag in other challenges. Alt text describes the content of the image and provides a text-alternative. This helps in case the image fails to load or can't be seen by a user. It's also used by search engines to understand what an image contains to include it in search results. Here's an example:
<img src="importantLogo.jpeg" alt="Company logo">
People with visual impairments rely on screen readers to convert web content to an audio interface. They won't get information if it's only presented visually. For images, screen readers can access the alt attribute and read its contents to deliver key information.
Good alt text is short but descriptive, and meant to briefly convey the meaning of the image. You should always include an alt attribute on your image. Per HTML5 specification, this is now considered mandatory.
<!--Add a box-shadow to a Card-like Element
The box-shadow property applies one or more shadows to an element.
The box-shadow property takes values for offset-x (how far to push the shadow horizontally from the element), offset-y (how far to push the shadow vertically from the element), blur-radius, spread-radius and a color value, in that order. The blur-radius and spread-radius values are optional.
Here's an example of the CSS to create multiple shadows with some blur, at mostly-transparent black colors:
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
The element now has an id of thumbnail. With this selector, use the example CSS values above to place a box-shadow on the card.-->
<!--Add a Negative Margin to an Element
An element's margin controls the amount of space between an element's border and surrounding elements.
If you set an element's margin to a negative value, the element will grow larger.
Try to set the margin to a negative value like the one for the red box.
Change the margin of the blue box to -15px, so it fills the entire horizontal width of the yellow box around it.-->
<style>
@Anna-Myzukina
Anna-Myzukina / AddASubmitButtonToAForm.html
Last active September 13, 2023 05:26
freecodecamp.org Responsive Web Design Certification (300 hours) Basic HTML and HTML5
<!--Add a Submit Button to a Form
Let's add a submit button to your form. Clicking this button will send the data from your form to the URL you specified with your form's action attribute.
Here's an example submit button:
<button type="submit">this button submits the form</button>
Add a button as the last element of your form element with a type of submit, and "Submit" as its text.-->
<h2>CatPhotoApp</h2>