​HelloSign API: Your development time matters

(This is a sponsored post.)
We know that no API can write your code for you, but ours comes close. We’ve placed great importance on making sure our API is the most developer-friendly API available — prioritizing clean documentation, an industry-first API dashboard for easy tracking and debugging, and trained API support engineers to personally assist with your integration. Meaning, you won’t find an eSignature product with an easier or faster path to implementation. It’s 2x faster than other …

​HelloSign API: Your development time matters is a post from CSS-Tricks

Link: http://synd.co/2Ag7QQ4

How to Build a Simple Blog Using React and GraphQL

This article was sponsored by Cosmic JS. Thank you for supporting the partners who make SitePoint possible.
In this tutorial I’m going to show you how to create a simple blog using React, GraphQL and Cosmic JS. This is going to be the fastest and most light-weight blog built on a modern technology stack. Let’s get started.
TL;DR
View the demo
Install the Simple React Blog on Cosmic JS
View the codebase on GitHub

Getting Started
Make sure that you have Node.js and NPM installed on your machine, if not, visit the Node.js website to install the latest version.
Let’s start by creating a folder for our app. In your favorite terminal run the following commands:
mkdir simple-react-blog
cd simple-react-blog

Now let’s add a package.json file to import all of our dependencies for our app:
vim package.json

Add the following to our package.json file:
{
“scripts": {
"dev": "node server.js",
"build": "next build",
"start": "next build; NODE_ENV=production node server.js"
},
"dependencies": {
"axios": "^0.16.2",
"express": "^4.16.2",
"lodash": "^4.17.4",
"next": "^4.0.3",
"next-routes": "^1.1.0",
"react": "^16.0.0",
"react-dom": "^16.0.0"
}
}

It’s a pretty light dependency list for a pretty light app. So what we will install is:

Axios for our promise-based HTTP client to get content from to the Cosmic JS GraphQL API.
Next.js as our React Universal framework.
Next routes for dynamic routes.
Express for our server-side web app framework.
React to handle our user interface.

Our scripts are necessary for starting our app in production and development.
Run the following command to install our dependencies:
npm i

Building Our Blog
Next, let’s begin building our blog pages. Create a pages folder and add the index.js file:
vim index.js

and add the following to index.js:
import axios from ‘axios’
import _ from ‘lodash’
import Footer from ‘./partials/footer’
import Header from ‘./partials/header’
import helpers from ‘../helpers’
import config from ‘../config’

export default class extends React.Component {
static async getInitialProps({ req }) {
const query = `{
objects(bucket_slug: "${config.bucket.slug}") {
_id
type_slug
slug
title
metadata
created_at
}
}`
return await axios.post(`https://graphql.cosmicjs.com/v1`, { query })
.then(function (response) {
return {
cosmic: {
posts: _.filter(response.data.data.objects, { type_slug: ‘posts’ }),
global: _.keyBy(_.filter(response.data.data.objects, { type_slug: ‘globals’ }), ‘slug’)
}
}
})
.catch(function (error) {
console.log(error)
})
}
render() {
if (!this.props.cosmic)
return

Loading…</div>
return (
<div>
<Header cosmic={ this.props.cosmic }/>
<main className="container">
{
this.props.cosmic.posts &&
this.props.cosmic.posts.map(post => {
const friendly_date = helpers.friendlyDate(new Date(post.created_at))
post.friendly_date = friendly_date.month + ‘ ‘ + friendly_date.date
return (
<div className="card" data-href={`/${post.slug}`} key={post._id}>
{
post.metadata.hero.imgix_url &&
<a href={`/${post.slug}`} className="blog-post-hero blog-post-hero–short" style={{ backgroundImage: `url(${post.metadata.hero.imgix_url})`}}></a>
}
<div className="card-padding">
<h2 className="blog__title blog__title–small">
<a href={`/${post.slug}`}>{post.title}</a>
</h2>
<div className="blog__author">
<a href={`/author/${post.metadata.author.slug}`}>
<div className="blog__author-image" style={{ backgroundImage: `url(${post.metadata.author.metafields[0].imgix_url}?w=100)`}}></div>
</a>
<div className="blog__author-title">by <a href={`/author/${post.metadata.author.slug}`}>{post.metadata.author.title}</a> on {post.friendly_date}</div>
<div className="clearfix"></div>
</div>
<div className="blog__teaser droid" dangerouslySetInnerHTML=></div>
<div className="blog__read-more">
<a href={`/${post.slug}`}>Read more…</a>
</div>
</div>
</div>
)
})
}
</main>
<Footer />
</div>
)
}
}

Continue reading %How to Build a Simple Blog Using React and GraphQL%

Link: https://www.sitepoint.com/build-a-simple-blog-using-react-graphql-cosmicjs/

​7 Days of Free Stock Images

(This is a sponsored post.)
Storyblocks is exploding with over 400,000 stock photos, vectors, backgrounds and more! With its user friendly site, massive library to choose from, and fresh new content, there’s no stopping what you can do. All of the content is 100% free from any royalties. Anything you download is yours to keep and use forever! Right now you can get 7 days of free downloads. Get up to 20 photos, icons, and vectors everyday for …

​7 Days of Free Stock Images is a post from CSS-Tricks

Link: http://synd.co/2mJTL8e

Excellent Resources for Web Professionals (Sponsored)

All web professionals, including web designers and developers, are looking every moment for ways to get the projects done faster, to respect deadlines, to deliver excellent quality and finally to have happy customers. This showcase is about excellent resources that will help you all achieve these results. You will find one of the best logo […]
The post Excellent Resources for Web Professionals (Sponsored) appeared first on David Walsh Blog.

Link: https://davidwalsh.name/excellent-resources-web-professionals

Top 12 Productivity Tips for WebStorm and Angular – Part 2

In this 2-part series, Google Developer Experts Jurgen Van de Moere and Todd Motto share their 12 favorite productivity tips for developing Angular applications using WebStorm.
You can check out part one here. In this second part, Todd shares his personal top 7 WebStorm features that allow him to increase his productivity on a daily basis:

Use Import Path Calculation
Live Templates
Run Tests within the IDE
Travel through Time
Use TypeScript Parameter Hints
Navigate using Breadcrumbs
And using WebStorm to look up Angular Documentation

Each tip will power up your productivity while developing Angular applications in WebStorm. Let’s explore these tips.
Before we get started!
When making changes to settings, remember that WebStorm allows you to change Settings/Preferences at an IDE scope and at a project scope separately.
Tip 6: Import Path Calculation
By default, WebStorm will resolve your import paths relative to the file. This setting will satisfy most projects and avoid unnecessary path editing. It’s also the method used for projects generated with the Angular CLI.
What’s fantastic about WebStorm is that you don’t have to type these import statements yourself! When you need to use a construct that would usually be imported, just type it where you need it. WebStorm will either suggest the construct to import through the AutoComplete context menu, or highlight the construct and give you the option to import it by pressing Option + Enter.
WebStorm will create a new import statement at the top of the document for you, or add the construct to an existing import group that is using the same source library.

WebStorm gives you other specialized options to handle your imports. For projects that require it, you can instruct WebStorm to calculate import paths relative to the tsconfig.json file location. If you decide to roll up your exports using a barrel index.ts file to import your components (read more about the Barrel technique) then you can use Use directory import (Node-style module resolution). This will use the Node.js module resolution strategy, instead of TypeScript’s classic module resolution strategy.
When importing submodules that don’t require the entire module to be imported, add that module to the Do not import exactly from list. WebStorm will skip the specified path during the automatic import. For example, instead of having:
import {Observable} from ‘rxjs’

Adding rxjs to the list yields:
import {Observable} from ‘rxjs/Observable’

WebStorms skips the rxjs module and imports the Observable submodule automatically for you!

Extra tip: Format input to use space inside curly brackets in Preferences | Editor | Code style | TypeScript – Spaces – Within – ES6 import/export braces.

Tip 7: Use Live Templates
When you find yourself writing certain patterns of code repeatedly, create a Live Template to quickly scaffold the block of code. WebStorm already comes with some predefined Live Templates that you may modify to fit your development style.
To create a Live Template, navigate to:

[macOS] WebStorm | Preferences | Editor | Live Templates
[Windows / Linux] File | Settings | Editor | Live Templates

You’ll see that WebStorm has already bundled the predefined Templates into categories. I created a category to bundle my ngrx Live Templates by clicking on the + sign and choosing “Template Group." I then created a new Live template within it by clicking on the + sign again, but choosing Live Template this time.
Let me walk you briefly through the elements that make a Live Template a productivity success:

Abbreviation: The shortcut you’ll type into the Editor to invoke your template.
Description: Tells you what the template does when invoked.
Template text: This is the code fragment to be scaffolded upon invocation. Take advantage of the powerful Live Template Variables that allow you to replace them with your desired text upon scaffolding.
Context: Choose in which language or pieces of code WebStorm should be sensitive to the Template.
Options: Define which key will allow you to expand the template and reformat it, according to the style settings defined on WebStorm | Preferences | Editor | Code Style.

You are ready to try out your template. Open a file that honors the context you defined and type your shortcut, press the defined expansion key and watch your template appear for you! If you defined any variables, the cursor will be placed where the first variable should be entered. If there are other variables defined, you can use tab to navigate to them – no need to click.

Tip 8: Running Tests
WebStorm is an excellent testing tool. You can run a variety of JavaScript tests right from the IDE, as long as you have the Node.js runtime environment installed on your computer and the NodeJS plugin enabled. Here are some productivity tips when running tests.
Continue reading %Top 12 Productivity Tips for WebStorm and Angular – Part 2%

Link: https://www.sitepoint.com/productivity-tips-for-webstorm-and-angular-part-2/

​BugReplay

(This is a sponsored post.)
Let’s say you’re trying to report a bug and you want to do the best possible job you can. Maybe it’s even your job! Say, you’re logging the bug for your own development team to fix. You want to provide as much detail and context as you can, without being overwhelming.
You know what works pretty well? Short videos.
Even better, video plus details about the context, like the current browser, platform, and version.…

​BugReplay is a post from CSS-Tricks

Link: http://synd.co/2lpzB2P

Manage and Protect Your Apple Devices

(This is a sponsored post.)
Jamf Now is a mobile device management solution for the iPad, iPhone, and Mac devices at work.
We make management tasks like deploying Wi-Fi passwords, setting up email accounts, securing company data, and enforcing passcodes, simple and affordable, so businesses can support their users. No IT required.
CSS-Tricks readers can manage their first 3 devices for free, forever! Sign up today to create your free account!

Direct Link to Article — Permalink…

Manage and Protect Your Apple Devices is a post from CSS-Tricks

Link: http://synd.co/2lmsHuU

Build a React App with User Authentication in 15 Minutes

This article originally appeared on the OKTA blog. Thank you for supporting the partners who make SitePoint possible.
React has quickly become one of the most favored front-end web frameworks, and is second only to plain old HTML5, according to JAXenter. So it’s no surprise that developers are learning it, and employers are asking for it.
In this tutorial, you’ll start with a very simple React app with a couple of pages and some routing built in, and add authentication using Okta’s Sign-In Widget. The Sign-In Widget is an embeddable Javascript widget that allows developers to use Okta’s secure, scalable architecture with a minimum of effort from within React applications. Let’s get started!
Get the Simple React Seed Project
Start by cloning the simple React seed project.
git clone https://github.com/leebrandt/simple-react-seed.git okta-react-widget-sample
cd okta-react-widget-sample

Add the Okta Sign-In Widget
Install the Okta Sign-In Widget using npm.
npm install @okta/okta-signin-widget@2.3.0 –save

This will add the Okta Sign-In Widget code to your node_modules folder. We’ll be using version 2.3.0 of the Sign-In Widget.

Then add the styles for the widget in your index.html file from the Okta CDN. Add these lines inside the tag:
<link
href=”https://ok1static.oktacdn.com/assets/js/sdk/okta-signin-widget/2.3.0/css/okta-sign-in.min.css"
type="text/css"
rel="stylesheet"/>

<!– Theme file: Customize or replace this file if you want to override our default styles –>
<link
href="https://ok1static.oktacdn.com/assets/js/sdk/okta-signin-widget/2.3.0/css/okta-theme.css"
type="text/css"
rel="stylesheet"/>

The LoginPage Component
First, create a folder called auth in the ./src/components folder, then create a file called LoginPage.js where the LoginPage component will go.
Start with the most basic of components:
import React from ‘react’;

export default class LoginPage extends React.Component{
render(){
return(
<div>Login Page</div>
);
}
}

This little component doesn’t do much but at least you now have a handle to add the LoginPage to your routing. So in your ./src/app.js file, you’ll import the component at the top:
import LoginPage from ‘./components/auth/LoginPage’;

and then add the route inside the main route (the one with the path of "/")
<Route path="/login" component={LoginPage}/>

Add the OpenID Connect Application in Okta
In order to use Okta as your OpenID Connect provider for authentication, you’ll need to set up an application in the Okta developer console.
If you don’t have an Okta developer account, go create one! Once you’re logged in, click on Applications in the top navbar, then click Add Application. Select SPA as the platform and click Next. Change the redirect URI to http://localhost:3000, and click Done. The application will be created with the following settings:

Now that you have an application created in Okta, you can set up the widget to talk to your new app!
Add the Widget to Your Component
import React from ‘react’;
import OktaSignIn from ‘@okta/okta-signin-widget’;

export default class LoginPage extends React.Component{
constructor(){
super();
this.widget = new OktaSignIn({
baseUrl: ‘https://{oktaOrgUrl}’,
clientId: ‘{clientId}’,
redirectUri: ‘http://localhost:3000’,
authParams: {
responseType: ‘id_token’
}
});
}

render(){
return(
<div>Login Page</div>
);
}
}

Copy the Client ID generated from your application’s settings page and paste it over {clientId}. Make sure you also replace {oktaOrgUrl} with your Okta organization URL, which you can find by going back to the main Dashboard page in the developer console. Usually it will look like: https://dev-12345.oktapreview.com.
Thus far you’ve imported the OktaSignIn function from the Okta Sign-In Widget npm module you installed earlier. Next, in the constructor of the component, you initialized an instance of OktaSignIn with the configuration for the application. This way, the application code will be able to talk to Okta and Okta will recognize that this is the app you just created.
Show The Login Widget
Next, you’ll create the code to actually render the Sign-In Widget to the page! You’ll need to change your render method to create an HTML element you can render the widget into. Make sure to get a reference to the element that will be rendered. Then, add a componentDidMount function to make sure you don’t try to render the widget before the HTML element is on the page.
Continue reading %Build a React App with User Authentication in 15 Minutes%

Link: https://www.sitepoint.com/build-react-app-user-authentication-15-minutes/

Make Like it Matters

(This is a sponsored post.)
Our sponsor Media temple is holding a contest to give away a bunch of stuff, including a nice big monitor and gift cards. Entering is easy, you just drop them an image or URL to a project you’re proud of. Do it quickly though, as entries end on Tuesday. Then the top 20 will be publicly voted on. US residents only.
Direct Link to Article — Permalink…

Make Like it Matters is a post from CSS-Tricks

Link: https://mediatemple.net/made-like-it-matters-contest/

Heavy images slowing down your site?

(This is a sponsored post.)
Speed is an important piece of a website user experience. Since images account for an average of 70% or more of a webpage’s weight, optimizing them is crucial to creating a faster website. That’s why we created Page Weight, a tool that will diagnose your site’s most problematic images and prescribe solutions on how to optimize them.
Simply enter your URL into Page Weight and we will prepare a custom report of your images …

Heavy images slowing down your site? is a post from CSS-Tricks

Link: http://synd.co/2xV9iY8