Tutorial by Examples

Code function add_new_style() { add_editor_style( 'file-name-here.css' ); } add_action( 'admin_init', 'add_new_style' ); Explanation In the above code, we used add_editor_style to load the css file. We also used add_action to make sure that WordPress runs our function.
add_theme_support( 'post-formats', array( 'formatone', 'formattwo' ) );
add_theme_support( 'post-thumbnails', array( 'post' ) ); The above code only allows post thumnails on all posts. To enable the feature on all post types, do: add_theme_support( 'post-thumbnails' );
In mathematics, especially Set Theory, we have a collection of things which is called set and we name those things as elements. We show a set with its name like A, B, C, ... or explicitly with putting its member on brace notation: {a, b, c, d, e}. Suppose we have an arbitrary element x and a set Z, ...
After you have set a few data to database and have get a structure consisting of several nodes like this; "user" : { "-KdbKcU2ptfYF2xKb5aO" : { "firstName" : "Arthur", "lastName" : "Schopenhauer", "userName&q...
Create enum of custom errors enum RegistrationError: Error { case invalidEmail case invalidPassword case invalidPhoneNumber } Create extension of RegistrationError to handle the Localized description. extension RegistrationError: LocalizedError { public var errorDescription...
public function someAction(){ // Action's code return new Response('<span>Hello world</span>'); }
public function someAction(){ // Action's code return new Response($error, 500); } Another example: public function someAction(){ // Action's code $response = new Response(); $response->setStatusCode(500) $response->setContent($content); ...
See list of http headers. public function someAction(){ // Action's code $response = new Response(); $response->headers->set('Content-Type', 'text/html'); return $response; }
Return JSON formated response: use Symfony\Component\HttpFoundation\JsonResponse; public function someAction(){ // Action's code $data = array( // Array data ); return new JsonResponse($data); }
Task<T> is a class and causes the unnecessary overhead of its allocation when the result is immediately available. ValueTask<T> is a structure and has been introduced to prevent the allocation of a Task object in case the result of the async operation is already available at the time of...
Type Families are not necessarily injective. Therefore, we cannot infer the parameter from an application. For example, in servant, given a type Server a we cannot infer the type a. To solve this problem, we can use Proxy. For example, in servant, the serve function has type ... Proxy a -> Server...
In this example, User Table will have a column that references the Agency table. CREATE TABLE agencies ( -- first create the agency table id SERIAL PRIMARY KEY, name TEXT NOT NULL ) CREATE TABLE users ( id SERIAL PRIMARY KEY, agency_id NOT NULL INTEGER REFERENCES agencies(id) DEFERR...
Sometimes, we want some fields in the JSON string to be optional. For example, data Person = Person { firstName :: Text , lastName :: Text , age :: Maybe Int } This can be achieved by import Data.Aeson.TH $(deriveJSON ...
In a data declaration, prefixing a type with a bang (!) makes the field a strict field. When the data constructor is applied, those fields will be evaluated to weak head normal form, so the data in the fields is guaranteed to always be in weak head normal form. Strict fields can be used in both rec...
The expiration values of a key can be managed by a user outside of the update commands. Redis allows a user to determine the current time to live (TTL) of a key using the TTL command: TTL key This command will return the TTL of a key in seconds or will return the special values -1 or -2. A -1 ...
wire d = 1'bx; // say from previous block. Will be 1 or 0 in hardware if (d == 1'b) // false in simulation. May be true of false in hardware
The following example demonstrates using Lumen in WAMP / MAMP / LAMP environments. To work with Lumen you need to setup couple of things first. Composer PHPUnit git (not required but strongly recommended) Assuming you have all these three components installed (at least you need composer), f...
Typescript allow to re-export declarations. //Operator.ts interface Operator { eval(a: number, b: number): number; } export default Operator; //Add.ts import Operator from "./Operator"; export class Add implements Operator { eval(a: number, b: number): number { ...
Simple Hello World Application: using System; namespace HelloWorld { class Program { static void Main(string[] args) { Console.WriteLine("Hello World"); } } } Equivalent IL Code (which will be JIT compiled) // Microsoft (R) ...

Page 1159 of 1336