Tutorial by Examples: ee

An external CSS stylesheet can be applied to any number of HTML documents by placing a <link> element in each HTML document. The attribute rel of the <link> tag has to be set to "stylesheet", and the href attribute to the relative or absolute path to the stylesheet. While usin...
The <article> element contains self-contained content like articles, blog posts, user comments or an interactive widget that could be distributed outside the context of the page, for example by RSS. When article elements are nested, the contents of the inner article node should be related t...
Extensions are used to extend the functionality of existing types in Swift. Extensions can add subscripts, functions, initializers, and computed properties. They can also make types conform to protocols. Suppose you want to be able to compute the factorial of an Int. You can add a computed property...
int i = 42; i = i++; /* Assignment changes variable, post-increment as well */ int a = i++ + i--; Code like this often leads to speculations about the "resulting value" of i. Rather than specifying an outcome, however, the C standards specify that evaluating such an expression produc...
It's possible to extent native elements, but their descendants don't get to have their own tag names. Instead, the is attribute is used to specify which subclass an element is supposed to use. For example, here's an extension of the <img> element which logs a message to the console when it's l...
HTML: <div class="wrapper"> <div class="left-sidebar"> <h1>Left Sidebar</h1> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p> </div> <div class="content"> <h1>Content</h1&g...
JavaScript has two primary ways to represent binary data in the browser. ArrayBuffers/TypedArrays contain mutable (though still fixed-length) binary data which you can directly manipulate. Blobs contain immutable binary data which can only be accessed through the asynchronous File interface. Conver...
Using the strtotime() function combined with date() you can parse different English text descriptions to dates: // Gets the current date echo date("m/d/Y", strtotime("now")), "\n"; // prints the current date echo date("m/d/Y", strtotime("10 September 2...
Whenever a value in set in localStorage, a storage event will be dispatched on all other windows from the same origin. This can be used to synchronize state between different pages without reloading or communicating with a server. For example, we can reflect the value of an input element as paragrap...
Given the following input: aaaaaAlazyZgreeedyAlaaazyZaaaaa We will use two patterns: one greedy: A.*Z, and one lazy: A.*?Z. These patterns yield the following matches: A.*Z yields 1 match: AlazyZgreeedyAlaaazyZ (examples: Regex101, Rubular) A.*?Z yields 2 matches: AlazyZ and AlaaazyZ (exampl...
This layout uses one floated column to create a two-column layout with no defined widths. In this example the left sidebar is "lazy," in that it only takes up as much space as it needs. Another way to say this is that the left sidebar is "shrink-wrapped." The right content column...
In this example, we're going to set up an Express server integration to display how to process a payment with PayPal, using the PayPal Node SDK. We will use a static JSON structure for the payment details for the sake of brevity. There are three general steps that we will follow when building out t...
The second step to creating a subscription for a user is to create and execute a billing agreement, based on an existing activated billing plan. This example assumes that you have already gone through and activated a billing plan in the previous example, and have an ID for that billing plan to refer...
Import the ElementTree object, open the relevant .xml file and get the root tag: import xml.etree.ElementTree as ET tree = ET.parse("yourXMLfile.xml") root = tree.getroot() There are a few ways to search through the tree. First is by iteration: for child in root: print(child.ta...
(Note: All examples using let are also valid for const) var is available in all versions of JavaScript, while let and const are part of ECMAScript 6 and only available in some newer browsers. var is scoped to the containing function or the global space, depending when it is declared: var x = 4; /...
project/jni/main.c #include <stdio.h> #include <unistd.h> int main(void) { printf("Hello world!\n"); return 0; } project/jni/Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := hello_world LOCAL_SRC_FILES := main.c include $(BU...
Sometimes you have a module that you only want to import so its top-level code gets run. This is useful for polyfills, other globals, or configuration that only runs once when your module is imported. Given a file named test.js: console.log('Initializing...') You can use it like this: import '...
Let's say you've got a list of restaurants -- maybe you read it from a file. You care about the unique restaurants in the list. The best way to get the unique elements from a list is to turn it into a set: restaurants = ["McDonald's", "Burger King", "McDonald's", &qu...
The Autocomplete widgets provides suggestions while you type into the field. <script> $(document).ready(function() { var tags = ["ask","always", "all", "alright", "one", "foo", "blackberry", "tweet","...
Dialog is a window which is overlay positioned within the viewport. <script> $(function() { $( "#dialog" ).dialog(); }); </script> <div id="dialog" title="Basic dialog"> <p>This is the default dialog which is useful for displayin...

Page 2 of 54