Tutorial by Examples: er

Hashes can be freely converted to and from arrays. Converting a hash of key/value pairs into an array will produce an array containing nested arrays for pair: { :a => 1, :b => 2 }.to_a # => [[:a, 1], [:b, 2]] In the opposite direction a Hash can be created from an array of the same form...
Firebase Authentication allows the users of your app to sign-in with social providers or their email+password. But what if you want to store additional information about a user, beyond what Firebase Authentication allows you to specify? Or what if you want to display a list of the users in your app...
The std::ops::Deref and std::ops::DerefMut traits are used for overloading the dereference operator, *x. For types A and B, impl Deref<Target=B> for A indicates that dereferencing a binding of &A will yield a &B and, impl DerefMut for A indicates that dereferencing a binding of...
This is a common gotcha with Laravel routes. Routes are matched in the order that they are declared. The first matching route is the one that is used. This example will work as expected: Route::get('/posts/{postId}/comments/{commentId}', 'CommentController@show'); Route::get('/posts/{postId}', 'P...
Stashing takes the dirty state of your working directory – that is, your modified tracked files and staged changes – and saves it on a stack of unfinished changes that you can reapply at any time. Stashing only modified files: Suppose you don't want to stash the staged files and only stash the mod...
Unlike the other helpers, this one uses static class helpers to serialize and deserialize, hence it is a little bit easier than the others to use. using Newtonsoft.Json; var rawJSON = "{\"Name\":\"Fibonacci Sequence\",\"Numbers\":[0, 1, 1, 2, 3, 5, 8, 13]}...
A simple example defining a Function that gets triggered by a Queue message: public static void StringMessage([QueueTrigger("my_queue")] string plainText) { //... } It also supports POCO serialization: public static void POCOMessage([QueueTrigger("my_queue")] MyPO...
A simple example of a Function that gets triggered when a Azure Storage Blob is modified: public static async Task BlobTrigger( [BlobTrigger("my_container/{name}.{ext}")] Stream input, string name, string ext) { //Blob with name {name} and extension {ext} using (StreamRead...
The SDK supports time triggered based on CRON expressions with 6 fields ({second} {minute} {hour} {day} {month} {day of the week}). It requires an extra setting on the JobHostConfiguration: config.UseTimers(); Your time triggered functions respond to this syntax: // Runs once every 5 minutes p...
Error handling is extremely important, we can define functions to be triggered when an execution error happens in one of your triggered functions: //Fires when 10 errors occur in the last 30 minutes (sliding) public static void ErrorMonitor([ErrorTrigger("0:30:00", 10)] TraceFilter filte...
extern crate serde; extern crate serde_json; #[macro_use] extern crate serde_derive; #[derive(Serialize)] struct Person { #[serde(rename="firstName")] first_name: String, #[serde(rename="lastName")] last_name: String, } fn main() { let person = ...
Sometimes builds take longer than expected. There are a few environment variables you can set to better understand what's happening during the build process. METEOR_DEBUG_BUILD=1 (logs progress) METEOR_PROFILE=<n> (logs time spent) METEOR_DEBUG_SPRINGBOARD=1 (?) METEOR_DEBUG_...
Meteor Tool To check the installed version of the Meteor tool, just run the following command outside of any Meteor projects: meteor --version To get a list of all official (recommended) Meteor releases, run: meteor show METEOR Meteor Projects If you want to check the project version of Me...
Using escaped brackets, you can define a capturing group in a pattern that can be backreferenced in the substitution string with \1: $ echo Hello world! | sed 's/\(Hello\) world!/\1 sed/' Hello sed With multiple groups: $ echo one two three | sed 's/\(one\) \(two\) \(three\)/\3 \2 \1/' three ...
<form asp-action="create" asp-controller="Home"> <!--Your form elements goes here--> </form>
<form asp-action="create" asp-controller="Home" asp-route-returnurl="dashboard" asp-route-from="google"> <!--Your form elements goes here--> </form> This will generate the below markup <form action=&qu...
Assuming your view is strongly typed to a view model like public class CreateProduct { public string Name { set; get; } } And you are passing an object of this to the view from your action method. @model CreateProduct <form asp-action="create" asp-controller="Home"...
Assuming your view is strongly typed to a view model like this public class CreateProduct { public IEnumerable<SelectListItem> Categories { set; get; } public int SelectedCategory { set; get; } } And in your GET action method, you are creating an object of this view model,...
Extension methods enable you to simplify your interface definitions by only including core required functionality in the interface itself and allowing you to define convenience methods and overloads as extension methods. Interfaces with fewer methods are easier to implement in new classes. Keeping o...
An interface is a definition of a contract between the user of the interface and the class that implement it. One way to think of an interface is as a declaration that an object can perform certain functions. Let's say that we define an interface IShape to represent different type of shapes, we exp...

Page 108 of 417