Tutorial by Examples: add

<?php /** * Panel: WPCustomize * * Basic Customizer panel with basic controls. * * @since 1.0.0 * @package WPC */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } // Customize function. if ( ! function_exists( 'wpc_panel_wpcustomize' ) ) { ...
Panels can have sections, sections can have settings, and settings can have controls. Settings are saved in the database, while the controls for particular settings are only used to display their corresponding setting to the user. This code creates a basic section in the panel from above. Inside a...
This is a sample adapter code. public class SampleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private static final int FOOTER_VIEW = 1; // Define a view holder for Footer view public class FooterViewHolder extends ViewHolder { public FooterViewHolder(View ite...
I/O in node is asynchronous, so interacting with the disk and network involves passing callbacks to functions. You might be tempted to write code that serves up a file from disk like this: var http = require('http'); var fs = require('fs'); var server = http.createServer(function (req, res) { ...
F# allows functions to be added as "members" to types when they are defined (for example, Record Types). However F# also allows new instance members to be added to existing types - even ones declared elsewhere and in other .net languages. The following example adds a new instance method D...
F# allow existing types to be extended with new static functions. type System.String with static member EqualsCaseInsensitive (a, b) = String.Equals(a, b, StringComparison.OrdinalIgnoreCase) This new function can be invoked like this: let x = String.EqualsCaseInsensitive("abc", &...
Modules can be used to add new functions to existing Modules and Types. namespace FSharp.Collections module List = let pair item1 item2 = [ item1; item2 ] The new function can then be called as if it was an original member of List. open FSharp.Collections module Testing = le...
To use a FloatingActionButton just add the dependency in the build.gradle file as described in the remarks section. Then add to the layout: <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" ...
A component is some sort of user interface element, such as a button or a text field. Creating a Component Creating components is near identical to creating a window. Instead of creating a JFrame however, you create that component. For example, to create a JButton, you do the following. JButton b...
In SpriteKit a Sprite is represented by the SKSpriteNode class (which inherits from SKNode). First of all create a new Xcode Project based on the SpriteKit template as described in Your First SpriteKit Game. Creating a Sprite Now you can create a SKSpriteNode using an image loaded into the Assets...
A self reference can be useful to build a hierarchical tree. This can be achieved with add_reference in a migration. class AddParentPages < ActiveRecord::Migration[5.0] def change add_reference :pages, :pages end end The foreign key column will be pages_id. If you want to decide a...
In a module (library or application) where you need the aar file you have to add in your build.gradle the repository: repositories { flatDir { dirs 'libs' } } and add the dependency: dependencies { compile(name:'nameOfYourAARFileWithoutExtension', ext:'aar') } Pay a...
Add a keystore using: keytool -genkey -v -keystore example.keystore -alias example -keyalg RSA -keysize 2048 -validity 10000 Note: This should be at root of project. Though not a hard requirement, it eases the file referencing Add a build.json with release/dev configuration for key...
Like an HTTP request, an HTTP response may include additional headers to modify or augment the response it provides. A full list of available headers is defined in §6.2 of the specification. The most commonly-used headers are: Server, which functions like a User-Agent request header for the serv...
Say you want to print variables in a 3 character column. Note: doubling { and } escapes them. s = """ pad {{:3}} :{a:3}: truncate {{:.3}} :{e:.3}: combined {{:>3.3}} :{a:>3.3}: {{:3.3}} :{a:3.3}: {{:3.3}} :{c:3...
Custom events usually need custom event arguments containing information about the event. For example MouseEventArgs which is used by mouse events like MouseDown or MouseUp events, contains information about Location or Buttons which used to generate the event. When creating new events, to create a...
Modern browsers provide a classList object to ease manipulation of the element's class attribute. Older browsers require direct manipulation of the element's className property. W3C DOM4 A simple method to add a class to an element is to append it to the end of the className property. This will no...
Add the following dependency to your project level build.gradle file. dependencies { classpath "io.realm:realm-gradle-plugin:3.1.2" } Add the following right at the top of your app level build.gradle file. apply plugin: 'realm-android' Complete a gradle sync and you now have ...
You have to point Gradle to the location of your plugins so Gradle can find them. Do this by adding a repositories { ... } to your build.gradle. Here's an example of adding three repositories, JCenter, Maven Repository, and a custom repository that offers dependencies in Maven style. repositories...
By Assembly Name, add library Add-Type -AssemblyName "System.Math" or by file path: Add-Type -Path "D:\Libs\CustomMath.dll" To Use added type: [CustomMath.NameSpace]::Method(param1, $variableParam, [int]castMeAsIntParam)

Page 9 of 32