Tutorial by Examples

Set scene as delegate //set your scene as SKPhysicsContactDelegate class yourScene: SKScene, SKPhysicsContactDelegate self.physicsWorld.contactDelegate = self; Then you have to implement one or the other of the contact functions: optional func didBegin(contact:) and/or optional fund didEnd...
MSBuild evaluates PropertyGroup, Choose and ItemGroup elements that are directly under the Project element before those that are in Target elements. Directly under the Project element, PropertyGroup and Choose elements are evaluated in the order in which they appear, and then ItemGroup elements a...
=SUMPRODUCT((A1:A100<>"")/COUNTIF(A1:A100,A1:A100&"")) counts unique cell values within A1:A100, excluding blank cells and ones with an empty string (""). How does it do that? Example: A1:A100 = [1, 1, 2, "apple", "peach", &qu...
=SUMPRODUCT(IF(FREQUENCY(MATCH(A1:A100,A1:A100,0),MATCH(A1:A100,A1:A100,0))>0,1))
add_action( 'init', function() { // do something here } ); Using a function block to hook a set of instructions. With the init hook, the set of instructions will be executed right after wordpress has finished loading the necessary components.
function my_init_function() { // do something here } add_action( 'init', 'my_init_function' ); Using the name of the function to hook a set of instructions. With the init hook, the set of instructions will be executed right after wordpress has finished loading the necessary components. ...
class MyClass { static function my_init_method() { // do something here } } add_action( 'init', array( 'MyClass', 'my_init_method' ) ); Using a static method of a class to hook a set of instructions. With the init hook, the set of instructions will be executed right after w...
class MyClass { function my_init_method() { // do something here } } $obj = new MyClass(); add_action( 'init', array( $obj, 'my_init_method' ) ); Using a method of an object to hook a set of instructions. With the init hook, the set of instructions will be executed right...
if (a > b) { trace("You win!"); } else if (a == b) { trace("It's a draw!"); } else { trace("You lose!"); } // Assigning the evaluated expression to a variable var message = if (a > b) { "You win!"; } else if (a == b) { &...
n % 2 == 0 ? trace("n is even!") : trace("n is odd!"); // Assigning the evaluated expression to a variable var message = n % 2 == 0 ? "n is even!" : "n is odd!"; trace(message); Reference "If", Haxe manual
switch (n % 2) { case 0: trace("n is even!"); case 1: trace("n is odd!"); default: trace("I don't know!"); } // Assigning the evaluated expression to a variable var message = switch (n % 2) { case 0: "n is even!"; case 1: "n ...
A loop is a control flow structure to definitely or indefinitely run a set of statement written only once in code, until a certain condition is met or the process is terminated. Condition loops These loops are repeated based on the state of their conditions. For loops For loops are usually run...
If different users need different datetime format then you may need to parse your incoming date string to actual date according to the format. In this case this snippet may help you. public class DateTimeBinder : DefaultModelBinder { public override object BindModel(ControllerContext control...
In this example you'll learn how to share a file with other apps. We'll use a pdf file in this example although the code works with every other format as well. The roadmap: Specify the directories in which the files you want to share are placed To share files we'll use a FileProvider, a class all...
public void doSomething() { DialogTestBinding binding = DataBindingUtil .inflate(LayoutInflater.from(context), R.layout.dialog_test, null, false); Dialog dialog = new Dialog(context); dialog.setContentView(binding.getRoot()); dialog.show(); }
Pulls the code from a certain specified file into another file where the call was made. E.g. inside example.php <h1>Hello World!</h1> Inside page.php // header code get_template_part('example'); // rest of page code Output: // header code <h1>Hello World</h1> /...
Any middleware registered as routeMiddleware in app/Http/Kernel.php can be assigned to a route. There are a few different ways to assign middleware, but they all do the same. Route::get('/admin', 'AdminController@index')->middleware('auth', 'admin'); Route::get('admin/profile', ['using' => ...
When the command-line syntax for an application is simple, it is reasonable to do the command argument processing entirely in custom code. In this example, we will present a series of simple case studies. In each case, the code will produce error messages if the arguments are unacceptable, and the...
This example shows how to use the Firebase Cloud Messaging(FCM) platform. FCM is a successor of Google Cloud Messaging(GCM). It does not require C2D_MESSAGE permissions from the app users. Steps to integrate FCM are as follows. Create sample hello world project in Android Studio Your Android...
This is a basic polymer element that show a list of names. <link rel="import" href="../bower_components/polymer/polymer.html"> <dom-module id="basic-list"> <template> <style> </style> <div>Name's list</div&g...

Page 861 of 1336