Tuesday, April 10, 2018

Navigation Menu Style 34

The post Navigation Menu Style 34 appeared first on Best jQuery.


by Admin via Best jQuery

VPN Usage and Cookie Deletion Around the World

VPNs are often considered important tools for securing internet and browsing freedom, with some using these tools to challenge attempts by governments to track or restrict their online activities. Almost a third of VPN Users say they use these tools to keep their anonymity while browsing...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World

Glide.js -JavaScript ES6 slider and carousel

Glide.js is a dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide, no less.


by via jQuery-Plugins.net RSS Feed

Monday, April 9, 2018

Top 10 Tips for Projecting Confidence

Confidence can be an elusive and slippery thing to get hold of at times in our lives, usually when we need it the most. Whether it’s a job interview or a first date or a big meeting at work, it’s important to be able to at least project some self confidence even when your nerves are jangling...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Irfan Ahmad via Digital Information World

Web Design Weekly #314

Headlines

Progressive Web Apps on iOS are here

With iOS 11.3, Apple has silently added support for the basic set of new technologies behind the idea of Progressive Web Apps. (medium.com)

Spectrum is now fully open source (spectrum.chat)

Sponsor Web Design Weekly and reach over 28,054 passionate designers and developers

Articles

The Comprehensive Guide to JavaScript Design Patterns

Design patterns are reusable solutions to commonly occurring problems in software design. In this post Marko MiĊĦura takes a look at some of the categories and then dives into the nitty gritty. (toptal.com)

Welcome to the age of problem roadmaps

Problem roadmaps are easier to think about, ensure your roadmap remains customer centric at all times and force you to think critically about the scope of the problem and the impact of a solution once all the evidence has come in. (medium.com)

Working on an iPad Pro as my main computer

Pretty cool to read about how Greg Jorgensen does all his programming and system admin work with an iPad Pro. (typicalprogrammer.com)

12 Things Everyone Should Understand About Tech (medium.com)

Tools / Resources

Static YouTube thumbnails are dead. Replace them instantly with gif-like previews

Imagine adding a line of code in your website and all embedded youtube videos have previews. This is Vuebit. Increase user interaction, double session duration, almost triple users who watch the video. Take the most out of youtube videos. (vuebit.com)

Preorder the new Going Offline book

In Going Offline, Jeremy Keith introduces you to service workers (and the code behind them) to show you the latest strategies in offline pages. It is sure to be another classic A Book Apart book. (abookapart.com)

MDX

MDX is a JSX in Markdown loader, parser, and renderer for ambitious projects. It combines the readability of Markdown with the expressivity of JSX. (github.com)

React Code Style Guide (css-tricks.com)

Diagram of modern React lifecycle methods (twitter.com)

Popular JavaScript projects on Github (boostlog.io)

Tower in Public Beta (git-tower.com)

Inspiration

The Inside Story of Reddit’s Redesign (wired.com)

Simon Pan’s personal site (simonpan.com)

Jobs

Product Designer at InVisionApp

If you have a passion for product design and an aptitude to work in a collaborative environment, can demonstrate empathy and strong advocacy for our users, while balancing the vision and constraints of engineering, then this might be the role for you! (invisionapp.com)

Principal/Lead Designer at Khan Academy

Product Designers! Come join Khan Academy and put your passion and skill for great design toward a deeply meaningful purpose. Join us on our mission to provide a free, world-class education for anyone, anywhere. (khanacademy.org)

Need to find passionate developers or designers? Why not advertise in the next newsletter

Last but not least…

Build the Right Thing (youtube.com)

The post Web Design Weekly #314 appeared first on Web Design Weekly.


by Jake Bresnehan via Web Design Weekly

20 Best WordPress Login Forms on CodeCanyon

Connecting Angular and the WordPress API with wp-api-angular

In this tutorial, you’ll learn how to work with the wp-api-angular library that allows you to interact with the WordPress API from Angular 2+ applications. This library supports all major WP resources including users, posts, comments, media, taxonomies etc. It’s also quite simple to use, so you’ll get the idea in no time.

To see the library in action, we’re going to code the following features:

  • Authentication using JWT
  • Listing the users
  • Listing the posts
  • Creating and editing the posts
  • Deleting the posts

By the end of the article, you’ll become familiar with this library and will be ready to use it on your own.

The source code for this tutorial is available on GitHub.

I’ll assume you’re using Angular 5, but all explained concepts should be valid for Angular 2 as well.

Laying Foundations

Setting Up WordPress

Before we proceed to writing the code, there are a couple of things to take care of. First of all, note that the API we’re going to utilize works only with the self-hosted version of WordPress. For the web version (which can be configured via the WordPress site), there’s a separate API that has many similar concepts, though it’s still quite different.

You also have to enable permalinks — which is required for the API client to work correctly. For Nginx, you’ll need to add the following line to the nginx.conf file:

try_files $uri $uri/ /index.php?$args;

More detailed information and explanations on how to enable permalinks can be found in this WordPress Codex guide.

Lastly, we should take care of WordPress security which, as they say, is above all. For that, a special plugin called JWT Authentication is required. We’re going to use it in order to authenticate our API client with the help of special tokens (an approach that’s quite common these days).

That’s pretty much it. If you’d like to learn more about the WordPress API in general, skim through this article. When you’re ready, proceed to the next step and let’s see the Angular WordPress client in action!

Bootstrapping an Angular Application

Now that we have WordPress prepared, create a new Angular application by running:

ng new wp-api

This is going to create a skeleton for the application. We’re not going to discuss its structure thoroughly, but you may find more information in our Angular series.

Next, cd into the directory and install the library itself:

cd wp-api
npm install -g typings
npm install wp-api-angular --save

Now we need to import the proper components inside the src/app/app.module.ts file:

// ... other imports
import { Http } from '@angular/http';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import {
  WpApiModule,
  WpApiLoader,
  WpApiStaticLoader
} from 'wp-api-angular';

WpApiModule should also be added to the imports block. Note that we must use an exported factory for AoT compilation or Ionic:

// ... imports

@NgModule({
  declarations: [
        // ... omitted
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpClientModule, // <---
    WpApiModule.forRoot({ // <---
      provide: WpApiLoader,
      useFactory: (WpApiLoaderFactory),
      deps: [Http]
    })

  ]
    // ...
})

Here’s the factory itself:

export function WpApiLoaderFactory(http: Http) {
  return new WpApiStaticLoader(http, 'http://YOUR_DOMAIN_HERE/wp-json/wp/v2/', '');
}

Don’t forget to provide your own domain name here!

Lastly, let’s also add some imports to the app.components.ts file:

import { Component } from '@angular/core';
import { Observable } from 'rxjs';
import { NgForm } from '@angular/forms';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import { Headers } from '@angular/http';

// ...

We’ll need NgForm to craft forms, HTTP modules to interact with the API and Headers to authenticate the client.

The initial setup is done and we can proceed to the next section.

Authentication

Before interacting with the API, we need to introduce an authentication mechanism. As I already mentioned above, a token-based authentication will be employed, so let’s add a token variable to the app.components.ts:

export class AppComponent {  
    token = null;
    // ...
}

Also, tweak the app.component.html file by adding a new block:

<div>
  <app-authentication [(token)]='token'></app-authentication>
</div>

In order for this to work, a separate component is required so generate it now:

ng generate component authentication

Import the necessary modules inside the src/app/authentication/authentication.component.ts file:

import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { HttpClientModule, HttpClient } from '@angular/common/http';
// ...

The authentication process is going to be very simple: a user should enter their login and password, submit the form, and a special token will be returned if the credentials are correct. This token will then be utilized to perform API requests. Therefore, let’s draft a user and add input and ouput for the AuthenticationComponent:

// ...
export class AuthenticationComponent implements OnInit {
  user = {
    login: '',
    password: ''
  }
  @Input() token;
    @Output() tokenChange = new EventEmitter<string>();

    // ...
}

Of course, you may define the user as a model, but for the purposes of this demo it’s not mandatory. As for the constructor, pass the HttpClient to it:

// ...
constructor( private http: HttpClient ) { }

Next code the auth method. It’s as simple as sending a POST request to the proper URL with the credentials and waiting for the response:

// ...
auth() {
  this.http.post('http://YOUR_DOMAIN/wp-json/jwt-auth/v1/token', {
    username: this.user.login,
    password: this.user.password
  }).subscribe((data) => {
    if (data['token']) { // if token is returned
      this.token = data['token'];
      this.tokenChange.emit(this.token);
    }
  });
}

Once again, don’t forget to insert your domain name into the URL.

The component is ready, and the last thing to do in this section is create the corresponding form. It should be displayed only if the token is null. When the form is submitted, the auth method should be called:

<form *ngIf='token == null' (ngSubmit)='auth()'>
</form>

Flesh the form out by adding two fields and a Submit button:

<form *ngIf='token == null' (ngSubmit)='auth()'>
    <div class='form-group'>
      <label for='login'>Login</label>
      <input type='text' class='form-control' [(ngModel)]='user.login' name='login' id='login' required>
    </div>

    <div class='form-group'>
      <label for='password'>Password</label>
      <input type='password' class='form-control' [(ngModel)]='user.password' name='password' id='password' required>
    </div>

    <button type="submit" class="btn btn-success">Submit</button>
</form>

That’s it! The authentication feature is finished, and we may start playing with the API itself.

Continue reading %Connecting Angular and the WordPress API with wp-api-angular%


by Ilya Bodrov-Krukowski via SitePoint