Tutorial by Examples: and

# Event handlers are attached using the 'on' method class ClickMe < Hyperloop::Component render do DIV do SPAN { "Hello There" } A { "Click Me" }.on(:click) { alert('you did it!' } end end end
In certain cases (e.g. logging) it might be useful to run task and do not await for the result. The following extension allows to run task and continue execution of the rest code: public static class TaskExtensions { public static async void RunAndForget( this Task task, Action<E...
This solution is more involved, leveraging custom TypeScript decorators which inject match, history and/or location data into your React.Component class, which gets you full type safety without needing any type guards, as the previous example required. // Routed.ts - defines decorators import { Ro...
PageTS Settings: ## Default Image cropping ## TCEFORM.sys_file_reference.crop.config.cropVariants { default { title = Desktop selectedRatio = NaN allowedAspectRatios { NaN { title = Free value = 0.0 } ...
Add repository repositories { maven { url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/" } } Add in Project Gradle for Chat Functionality dependencies { compile("com.quickblox:quickblox-android-sdk-chat:2.6.1&...
Consider the array declared as real x(10) Then we have three aspects of interest: The whole array x; Array elements, like x(1); Array sections, like x(2:6). Whole arrays In most cases the whole array x refers to all of the elements of the array as a single entity. It may appear in exec...
Create new script section. I call that sa(Script Anonymuos) that meens for me generate JavaScript section with anonymuous function call inside. <script type="text/javascript"> $(function () { $END$ }); </script> If in your project still use old jQuery you c...
Firstly it's important to note that when a new socket is created it is assigned a unique Id which is retrieved by calling socket.id. This id can then be stored within a user object and we can assign an identifier such as a username which has been used in this example to retrieve user objects. /** ...
The following example sets a promise to be consumed by another thread: { auto promise = std::promise<std::string>(); auto producer = std::thread([&] { promise.set_value("Hello World"); }); auto fut...
std::packaged_task bundles a function and the associated promise for its return type: template<typename F> auto async_deferred(F&& func) -> std::future<decltype(func())> { auto task = std::packaged_task<decltype(func())()>(std::forward<F>(func)); aut...
If constraints for std::promise and std::future are not met an exception of type std::future_error is thrown. The error code member in the exception is of type std::future_errc and values are as below, along with some test cases: enum class future_errc { broken_promise = /* the t...
Table/Column Names Two common ways of formatting table/column names are CamelCase and snake_case: SELECT FirstName, LastName FROM Employees WHERE Salary > 500; SELECT first_name, last_name FROM employees WHERE salary > 500; Names should describe what is stored in their object. Th...
if len(sys.argv) != 4: # The script name needs to be accounted for as well. raise RuntimeError("expected 3 command line arguments") f = open(sys.argv[1], 'rb') # Use first command line argument. start_line = int(sys.argv[2]) # All arguments come as strings, so need to ...
# Error messages should not go to standard output, if possible. print('ERROR: We have no cheese at all.', file=sys.stderr) try: f = open('nonexistent-file.xyz', 'rb') except OSError as e: print(e, file=sys.stderr)
def main(): if len(sys.argv) != 4 or '--help' in sys.argv[1:]: print('usage: my_program <arg1> <arg2> <arg3>', file=sys.stderr) sys.exit(1) # use an exit code to signal the program was unsuccessful process_data()
$man <command> Displays the on-line manual pages for the command $clear Clears the terminal screen $pwd Returns the working directory name $echo <string> Writes the string to the standard output $printf <string> Format and print the string Example: print $PATH ...
To show the value of making generalized functions like those in the previous example (make_title, make_axes, make_buttons, etc), consider this box and whisker chart: https://bl.ocks.org/SumNeuron/262e37e2f932cf4b693f241c52a410ff While the code for making the boxes and whiskers is more intensive tha...
You first must create a "Game" object in Phaser. var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create }); In the preload callback function load the image. function preload() { game.load.image('thing', 'assets/thing-image.png'); ...
dplyr uses Non-Standard Evaluation(NSE), which is why we normally can use the variable names without quotes. However, sometimes during the data pipeline, we need to get our variable names from other sources such as a Shiny selection box. In case of functions like select, we can just use select_ to u...
<?php // Setting parameters $time = time(); $values = [7, $time, $time]; // Prints "At 3:50:31 PM on Apr 19, 2015, there was a disturbance on planet 7." $pattern = "At {1, time} on {1, date}, there was a disturbance on planet {0, number}."; $formatter = new Messa...

Page 140 of 153