sudo vim /etc/postfix/sasl_passwd
<?php | |
// ecco l'action che fa funzionare la nostra chiamata | |
add_action('rest_api_init', function () { | |
// registriamo la nuova rotta, il primo parametro equivale al namespace, potrebbe essere myplugin/v1 ecc ecc | |
// il secondo parametro equivale al percorso che vogliamo usare e le eventuali opzioni, | |
// in questo esempio abbiamo aggiunto il parametro id, questo valore sarà poi disponibile nella funzione di callback | |
register_rest_route( 'test/v1', '/post/(?P<id>\d+)', array( | |
'methods' => 'GET', // specifichiamo il metodo http | |
// specifichiamo la funzione di callback dove andremo a specificare cosa ritornare |
Many people who work with React are familiar with the excellent classnames
library. If you aren't familiar, it provides a simple function for gluing classnames together. In web programming in general, there are many times that we need to add or remove multiple classes based on conditional logic. The classnames library makes this easy.
More and more developers are embracing CSS Next and the power of CSS modules. However, when you add CSS modules to your react components, working with classnames gets more difficult. Typically, CSS modules is implemented with class name mangling. Transforming human readable class name strings into unique identifiers helps ensure that every class name in your app is unique.
This means that you can write your component CSS in isolation without worrying about the dreaded class name collisions that have plagued CSS
#Import datasets and libraries | |
from sklearn.datasets import fetch_20newsgroups | |
from sklearn.naive_bayes import MultinomialNB | |
from sklearn.feature_extraction.text import CountVectorizer | |
#Category selection to compare different datasets of emails and evaluate how hard is to distinguish those. | |
the_categories = ['comp.sys.ibm.pc.hardware', 'rec.sport.hockey'] | |
train_emails = fetch_20newsgroups(categories = the_categories, subset = 'train', shuffle = True, random_state = 108) | |
test_emails = fetch_20newsgroups(categories = the_categories, subset = 'test', shuffle = True, random_state = 108) |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
class Follow extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
password: 'huraji', | |
authorized: false | |
}; |
import React from 'react'; | |
export class BestSeller extends React.Component { | |
render() { | |
return ( | |
<li> | |
Title: <span> | |
{this.props.title} | |
</span><br /> | |
// Normal way to display a prop: | |
export class MyComponentClass extends React.Component { | |
render() { | |
return <h1>{this.props.title}</h1>; | |
} | |
} | |
// Stateless functional component way to display a prop: | |
export const MyComponentClass = (props) => { | |
return <h1>{props.title}</h1>; |
/* Separating container components from presentational components is a popular React programming pattern. | |
Here’s the basic idea behind it: if a component has to have state, make calculations based on props, or manage any other complex logic, then that component shouldn’t also have to render HTML-like JSX. | |
Instead of rendering HTML-like JSX, the component should render another component. It should be that component’s job to render HTML-like JSX. | |
Following this pattern separates your business logic from your presentational logic. */ | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { GuineaPigs } from '../components/GuineaPigs'; | |
const GUINEAPATHS = [ |