Tutorial by Examples: st

Add gem 'figaro' to your Gemfile and run bundle install. Then run bundle exec figaro install; this will create config/application.yml and add it to your .gitignore file, preventing it from being added to version control. You can store your keys in application.yml in this format: SECRET_NAME: secre...
It's possible to specify several type constraints for generics using the where clause: func doSomething<T where T: Comparable, T: Hashable>(first: T, second: T) { // Access hashable function guard first.hashValue == second.hashValue else { return } // Access compa...
Sometimes you want to switch off all previously registered listeners. //Adding a normal click handler $(document).on("click",function(){ console.log("Document Clicked 1") }); //Adding another click handler $(document).on("click",function(){ console.log(&q...
Note: The Redis project does not officially support Windows. However, the Microsoft Open Tech group develops and maintains this Windows port targeting Win64. Official redis.io/download You can choose to download different versions or the latest version of Redis github.com/MSOpenTech/redis/release...
$array = [1, 0, 5, 9, 3, 7, 6, 8, 4, 2]; usort($array, function (int $a, int $b): int { return $a <=> $b; }); print_r($array); Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 [6] => 6 [7] => 7 [8...
Detailed instructions on getting jooq set up or installed.
Yarn uses the same registry that npm does. That means that every package that is a available on npm is the same on Yarn. To install a package, run yarn add package. If you need a specific version of the package, you can use yarn add package@version. If the version you need to install has been tag...
Ordered broadcasts are used when you need to specify a priority for broadcast listeners. In this example firstReceiver will receive broadcast always before than a secondReceiver: final int highPriority = 2; final int lowPriority = 1; final String action = "action"; // intent filter ...
Detailed instructions on getting django-views set up or installed.
A docstring is a multi-line comment used to document modules, classes, functions and methods. It has to be the first statement of the component it describes. def hello(name): """Greet someone. Print a greeting ("Hello") for the person with the given name. &...
Virtual Environment tool (virtualenv) is used to isolate different projects and their dependencies by creating individual python environments for each of them. It's like installing a package locally (and not globally), similar to npm package installation option. Following is an example to install ...
Ajax calls, request and retrieve data for giving the user a sense of a better interactive user interface experience. This article will show you how to use jQuery and send data through Ajax calls. For this example, we’re going to POST the following JavaScript object to our server. var post = { ...
Prerequisite A running MongoDB server, more details on that here. Setting Up a Java Project The MongoDB Java Driver is supplied as a JAR file and can be included in a project just like any other JAR. For example: Maven: add an entry to the <dependencies> section of your pom.xml. &lt...
Using sequence function you can easily describe a message that calls a list of other messages. It's useful when dealing with semantics of your messages. Example 1: You are making a game engine, and you need to refresh the screen on every frame. module Video exposing (..) type Message = module Vid...
Detailed instructions on getting optimization set up or installed.
To register your methods, the class containing the EventHandler(s) must implement the Listener interface. import org.bukkit.event.Listener; public final class ListenerClass implements Listener { } You need to register the event listener by adding the following call to your onEnable method in...
Creating an event listener in Forge is very similar to creating one in Bukket. Creating the listener class requires a lot less. There's no interface to implement or other imports. public class ListenerClass { } //perfectly valid event listener class Registering it requires passing the instance ...
public static MvcHtmlString DatePickerFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, object htmlAttributes) { var sb = new StringBuilder(); var metaData = ModelMetadata.FromLambdaExpression(expression, htm...
In order to install asyncio: pip install asyncio Notice that python asyncio requires Python 3.3 or later. This module became part of the Python standard library since Python 3.4.
Sometimes you need to create your own Event, one that other plugins can listen to (Vault, among other plugins, does this) and even cancel. Bukkit's Event API allows this to be possible. All you need to do is make a new class, have it extend Event, add the handlers and the attributes your event needs...

Page 335 of 369