Tutorial by Examples: pre

This hook is called before git rebase begins to alter code structure. This hook is typically used for making sure a rebase operation is appropriate. This hook takes 2 parameters: the upstream branch that the series was forked from, and the branch being rebased (empty when rebasing the current b...
This hook is executed every time somebody uses git push to push commits to the repository. It always resides in the remote repository that is the destination of the push and not in the originating (local) repository. The hook runs before any references are updated. It is typically used to enforce a...
var express = require('express'); var cors = require('cors'); // Use cors module for enable Cross-origin resource sharing var app = express(); app.use(cors()); // for all routes var port = process.env.PORT || 8080; app.get('/', function(req, res) { var info = { 'string_value...
Sometimes it can be useful to set your application locale based upon the request IP. You can easily achieve this using Geocoder. Among the many things Geocoder does, it can also tell the location of a request. First, add Geocoder to your Gemfile # Gemfile gem 'geocoder' Geocoder adds location...
The following examples can be tested on https://ellie-app.com/m9vmQ8NcMc/0. import Html exposing (..) import Json.Decode payload = """ [ { "bark": true, "tag": "dog", "name": "Zap", "playful": true } , { "w...
DROP PROCEDURE if exists displayNext100WithName; DELIMITER $$ CREATE PROCEDURE displayNext100WithName ( nStart int, tblName varchar(100) ) BEGIN DECLARE thesql varchar(500); -- holds the constructed sql string to execute -- expands the sizing of the output buffer to accomoda...
iota can be used in expressions, so it can also be used to assign values other than simple incrementing integers starting from zero. To create constants for SI units, use this example from Effective Go: type ByteSize float64 const ( _ = iota // ignore first value by assigning to b...
Because iota is incremented after each ConstSpec, values within the same expression list will have the same value for iota: const ( bit0, mask0 = 1 << iota, 1<<iota - 1 // bit0 == 1, mask0 == 0 bit1, mask1 // bit1 == 2, mask1 == 1 _, _ ...
for comprehensions in Scala are just syntactic sugar. These comprehensions are implemented using the withFilter, foreach, flatMap and map methods of their subject types. For this reason, only types that have these methods defined can be utilized in a for comprehension. A for comprehension of the fo...
The r method implicitly provided via scala.collection.immutable.StringOps produces an instance of scala.util.matching.Regex from the subject string. Scala's triple-quoted string syntax is useful here, as you do not have to escape backslashes as you would in Java: val r0: Regex = """(...
To create a human-readable presentation of a model object you need to implement Model.__str__() method (or Model.__unicode__() on python2). This method will be called whenever you call str() on a instance of your model (including, for instance, when the model is used in a template). Here's an exampl...
library(tidyr) ## example data set.seed(123) df <- data.frame( name = rep(c("firstName", "secondName"), each=4), numbers = rep(1:4, 2), value = rnorm(8) ) df # name numbers value # 1 firstName 1 -0.56047565 # 2 firstName 2 -0.2301...
From the official documentation: If you want to get advanced, you can also open up the project file for a specific platform by opening the required XCode or Android Eclipse project in platforms/PLATFORM inside the root of your project. Then, you can build and test from inside the platform-specifi...
This example uses a push button (tact switch) attached to digital pin 2 and GND, using an internal pull-up resistor so pin 2 is HIGH when the button is not pressed. const int LED_PIN = 13; const int INTERRUPT_PIN = 2; volatile bool ledState = LOW; void setup() { pinMode(LED_PIN, OUTPUT); ...
Html <img id="cats"></img> Dart import 'dart:html'; /// Stores the image in [blob] in the [ImageElement] of the given [selector]. void setImage(selector, blob) { FileReader reader = new FileReader(); reader.onLoad.listen((fe) { ImageElement image = document...
To get the previous element you can use the .prev() method. <ul> <li>Mark</li> <li class="anna">Anna</li> <li>Paul</li> </ul> If you are standing on the "Anna" element and you want to get the previous element, &q...
Most developers encounter backpressure when their application fails with MissingBackpressureException and the exception usually points to the observeOn operator. The actual cause is usually the non-backpressured use of PublishSubject, timer() or interval() or custom operators created via create(). ...
HTTP describes how an HTTP client, such as a web browser, sends an HTTP request via a network to an HTTP server, which then sends an HTTP response back to the client. The HTTP request is typically either a request for an online resource, such as a web page or image, but may also include additiona...
Retrofit2 comes with support for multiple pluggable execution mechanisms, one of them is RxJava. To use retrofit with RxJava you first need to add the Retrofit RxJava adapter to your project: compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0' then you need to add the adapter when building yo...
This example shows how to create a prepared statement with an insert statement with parameters, set values to those parameters and then executing the statement. Connection connection = ... // connection created earlier try (PreparedStatement insert = connection.prepareStatement( "i...

Page 10 of 34