diff --git a/_config.yml b/_config.yml index 03c67bce382..ca995a4d181 100644 --- a/_config.yml +++ b/_config.yml @@ -4,15 +4,15 @@ # You can create any custom variable you would like, and they will be accessible # in the templates via {{ site.myvariable }}. -title: Web Development Tips 101 -email: support@webtips101.com -author: webtips101 +title: 30 Days of JavaScript +email: support@30daysofjavascript.com +author: John copyright: Copyright © 2019-2021 description:>- # this means to ignore newlines until "baseurl:" - Tips for learning web development. + Learn JavaScript in 30 days! baseurl: "" # the subpath of your site, e.g. /blog -url: "https://webtips101.com" # the base hostname & protocol for your site, e.g. http://example.com +url: "https://30daysofjavascript.com" # the base hostname & protocol for your site, e.g. http://example.com favicon: "" # the favicon for your site permalink: /:title/ @@ -104,8 +104,8 @@ header_pages: # Page default value defaults: home: - heading: "Web development tips" - subheading: "Learn web development with our quick tips!" + heading: "30 Days of JavaScript" + subheading: "Learn JavaScript in 30 days!" banner: "Your image url" # Excerpt size setting diff --git a/_layouts/home.html b/_layouts/home.html index 4753b165a9c..3366db12677 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -1,5 +1,5 @@ --- -layout: articles +layout: nil heading: 'Your awesome heading' subheading: 'Your awesome subheading' banner: 'default' diff --git a/_posts/2015-02-28-test-markdown.md b/_posts/2015-02-28-test-markdown.md deleted file mode 100644 index ff63e2ac6be..00000000000 --- a/_posts/2015-02-28-test-markdown.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -layout: post -title: Test markdown -subtitle: Each post also has a subtitle -categories: markdown -tags: [test] ---- - -You can write regular [markdown](http://markdowntutorial.com/) here and Jekyll will automatically convert it to a nice webpage. I strongly encourage you to [take 5 minutes to learn how to write in markdown](http://markdowntutorial.com/) - it'll teach you how to transform regular text into bold/italics/headings/tables/etc. - -**Here is some bold text** - -## Here is a secondary heading - -Here's a useless table: - -| Number | Next number | Previous number | -| :------ |:--- | :--- | -| Five | Six | Four | -| Ten | Eleven | Nine | -| Seven | Eight | Six | -| Two | Three | One | - - -How about a yummy crepe? - - - -It can also be centered! - -{: .center-block :} - -Here's a code chunk: - -~~~ -var foo = function(x) { - return(x + 5); -} -foo(3) -~~~ - -And here is the same code with syntax highlighting: - -```javascript -var foo = function(x) { - return(x + 5); -} -foo(3) -``` - -And here is the same code yet again but with line numbers: - -{% highlight javascript linenos %} -var foo = function(x) { - return(x + 5); -} -foo(3) -{% endhighlight %} - -## Boxes -You can add notification, warning and error boxes like this: - -### Notification - -{: .box-note} -**Note:** This is a notification box. - -### Warning - -{: .box-warning} -**Warning:** This is a warning box. - -### Error - -{: .box-error} -**Error:** This is an error box. diff --git a/_posts/2016-05-20-super-long-article.md b/_posts/2016-05-20-super-long-article.md deleted file mode 100644 index 5652a9a267b..00000000000 --- a/_posts/2016-05-20-super-long-article.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -layout: post -title: "Some articles are just so long they deserve a really long title to see if things will break well" -categories: misc ---- - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce bibendum neque eget nunc mattis eu sollicitudin enim tincidunt. Vestibulum lacus tortor, ultricies id dignissim ac, bibendum in velit. Proin convallis mi ac felis pharetra aliquam. Curabitur dignissim accumsan rutrum. In arcu magna, aliquet vel pretium et, molestie et arcu. Mauris lobortis nulla et felis ullamcorper bibendum. Phasellus et hendrerit mauris. Proin eget nibh a massa vestibulum pretium. Suspendisse eu nisl a ante aliquet bibendum quis a nunc. Praesent varius interdum vehicula. Aenean risus libero, placerat at vestibulum eget, ultricies eu enim. Praesent nulla tortor, malesuada adipiscing adipiscing sollicitudin, adipiscing eget est. - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce bibendum neque eget nunc mattis eu sollicitudin enim tincidunt. Vestibulum lacus tortor, ultricies id dignissim ac, bibendum in velit. Proin convallis mi ac felis pharetra aliquam. Curabitur dignissim accumsan rutrum. In arcu magna, aliquet vel pretium et, molestie et arcu. Mauris lobortis nulla et felis ullamcorper bibendum. Phasellus et hendrerit mauris. Proin eget nibh a massa vestibulum pretium. Suspendisse eu nisl a ante aliquet bibendum quis a nunc. Praesent varius interdum vehicula. Aenean risus libero, placerat at vestibulum eget, ultricies eu enim. Praesent nulla tortor, malesuada adipiscing adipiscing sollicitudin, adipiscing eget est. - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce bibendum neque eget nunc mattis eu sollicitudin enim tincidunt. Vestibulum lacus tortor, ultricies id dignissim ac, bibendum in velit. Proin convallis mi ac felis pharetra aliquam. Curabitur dignissim accumsan rutrum. In arcu magna, aliquet vel pretium et, molestie et arcu. Mauris lobortis nulla et felis ullamcorper bibendum. Phasellus et hendrerit mauris. Proin eget nibh a massa vestibulum pretium. Suspendisse eu nisl a ante aliquet bibendum quis a nunc. Praesent varius interdum vehicula. Aenean risus libero, placerat at vestibulum eget, ultricies eu enim. Praesent nulla tortor, malesuada adipiscing adipiscing sollicitudin, adipiscing eget est. diff --git a/_posts/2016-08-12-my-example-post.md b/_posts/2016-08-12-my-example-post.md deleted file mode 100644 index d64a84dd1a8..00000000000 --- a/_posts/2016-08-12-my-example-post.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -layout: post -categories: junk ---- - -Eos eu docendi tractatos sapientem, brute option menandri in vix, quando vivendo accommodare te ius. Nec melius fastidii constituam id, viderer theophrastus ad sit, hinc semper periculis cum id. Noluisse postulant assentior est in, no choro sadipscing repudiandae vix. Vis in euismod delenit dignissim. Ex quod nostrum sit, suas decore animal id ius, nobis solet detracto quo te. - -{% comment %} -Might you have an include in your theme? Why not try it here! -{% include my-themes-great-include.html %} -{% endcomment %} - -No laudem altera adolescens has, volumus lucilius eum no. Eam ei nulla audiam efficiantur. Suas affert per no, ei tale nibh sea. Sea ne magna harum, in denique scriptorem sea, cetero alienum tibique ei eos. Labores persequeris referrentur eos ei. diff --git a/_posts/2017-05-20-this-post-demonstrates-post-content-styles.md b/_posts/2017-05-20-this-post-demonstrates-post-content-styles.md deleted file mode 100644 index ec675ca3160..00000000000 --- a/_posts/2017-05-20-this-post-demonstrates-post-content-styles.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -layout: post -title: "This post demonstrates post content styles" -categories: junk -author: "Bart Simpson" -meta: "Springfield" ---- - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce bibendum neque eget nunc mattis eu sollicitudin enim tincidunt. Vestibulum lacus tortor, ultricies id dignissim ac, bibendum in velit. - -## Some great heading (h2) - -Proin convallis mi ac felis pharetra aliquam. Curabitur dignissim accumsan rutrum. In arcu magna, aliquet vel pretium et, molestie et arcu. - -Mauris lobortis nulla et felis ullamcorper bibendum. Phasellus et hendrerit mauris. Proin eget nibh a massa vestibulum pretium. Suspendisse eu nisl a ante aliquet bibendum quis a nunc. Praesent varius interdum vehicula. Aenean risus libero, placerat at vestibulum eget, ultricies eu enim. Praesent nulla tortor, malesuada adipiscing adipiscing sollicitudin, adipiscing eget est. - -## Another great heading (h2) - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce bibendum neque eget nunc mattis eu sollicitudin enim tincidunt. Vestibulum lacus tortor, ultricies id dignissim ac, bibendum in velit. - -### Some great subheading (h3) - -Proin convallis mi ac felis pharetra aliquam. Curabitur dignissim accumsan rutrum. In arcu magna, aliquet vel pretium et, molestie et arcu. Mauris lobortis nulla et felis ullamcorper bibendum. - -Phasellus et hendrerit mauris. Proin eget nibh a massa vestibulum pretium. Suspendisse eu nisl a ante aliquet bibendum quis a nunc. - -### Some great subheading (h3) - -Praesent varius interdum vehicula. Aenean risus libero, placerat at vestibulum eget, ultricies eu enim. Praesent nulla tortor, malesuada adipiscing adipiscing sollicitudin, adipiscing eget est. - -> This quote will change your life. It will reveal the secrets of the universe, and all the wonders of humanity. Don't misuse it. - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce bibendum neque eget nunc mattis eu sollicitudin enim tincidunt. - -### Some great subheading (h3) - -Vestibulum lacus tortor, ultricies id dignissim ac, bibendum in velit. Proin convallis mi ac felis pharetra aliquam. Curabitur dignissim accumsan rutrum. - -```html - - -
Hello, World!
-Highlighted Text!
+``` + +`Renderer2` also gets instantiated. Which injector do these services come from? Well, each service’s source code comes from `@angular/core`. These services must then register with the application’s root injector. + +```typescript +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; +import { AppComponent } from './app.component'; +import { HighlightDirective } from './directives/highlight.directive'; + +@NgModule({ + declarations: [ + AppComponent, + HighlightDirective + ], + imports: [ + BrowserModule + ], + providers: [], + bootstrap: [ + AppComponent + ] +}) +export class AppModule { } +``` + +An empty providers array!? Not to fear. Angular registers many services with the root injector automatically. This includes `ElementRef` and `Renderer2`. In this example, we are managing the host element through its interface stemming from the instantiation of `ElementRef`. `Renderer2` lets us update the DOM through Angular’s view model. + +You can read more about views from [this article](https://guide.freecodecamp.org/angular/views). They are the preferred method for DOM/view updates in Angular applications. + +It is important recognize the role that injectors play in the above example. By declaring variable types in the constructor, the class obtains valuable services. Each parameter’s data type maps to a set of instructions within the injector. If the injector has that type, it returns an instance of said type. + +## Instantiating Services + +The [Services and Injectors](https://guide.freecodecamp.org/angular/services-and-injectors) article explains this section to an extent. Though, this section rehashes the previous section or the most part. Services will often provide references to something else. They may just as well provide an interface extending a class’ capabilities. + +The next example will define a logging service that gets added to a component’s injector via its `providers: []` metadata. + +```typescript +// services/logger.service.ts + +import { Injectable } from '@angular/core'; + +@Injectable() +export class LoggerService { + callStack: string[] = []; + + addLog(message: string): void { + this.callStack = [message].concat(this.callStack); + this.printHead(); + } + + clear(): void { + this.printLog(); + this.callStack = []; + console.log("DELETED LOG"); + } + + private printHead(): void { + console.log(this.callStack[0] || null); + } + + private printLog(): void { + this.callStack.reverse().forEach((log) => console.log(message)); + } +} +``` + +```typescript +// app.component.ts + +import { Component } from '@angular/core'; +import { LoggerService } from './services/logger.service'; + +@Component({ + selector: 'app-root', + templateUrl: './app.component.html', + providers: [LoggerService] +}) +export class AppComponent { + constructor(private logger: LoggerService) { } + + logMessage(event: any, message: string): void { + event.preventDefault(); + this.logger.addLog(`Message: ${message}`); + } + + clearLog(): void { + this.logger.clear(); + } +} +``` + +```html +// app.component.html + ++ {{ jobListing.description }} +
++ Skills: {{ jobListing.skills }} +
+