Tutorial by Examples: er

var http = require('http'); var fs = require('fs'); var path = require('path'); http.createServer(function (request, response) { console.log('request ', request.url); var filePath = '.' + request.url; if (filePath == './') filePath = './index.html'; var extname = String(path.extnam...
// Website you wish to allow to connect to response.setHeader('Access-Control-Allow-Origin', '*'); // Request methods you wish to allow response.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'); // Request headers you wish to allow response.setHeader('Acce...
func bufferedUnbufferedExample(buffered bool) { // We'll declare the channel, and we'll make it buffered or // unbuffered depending on the parameter `buffered` passed // to this function. var ch chan int if buffered { ch = make(chan int, 3) } else { ch...
If you want to detect when your user enters a specific location, you can create a fence for the specific location with a radius you want and be notified when your user enters or leaves the location. // Your own action filter, like the ones used in the Manifest private static final String FENCE_REC...
We use the following media queries in our Less files to create the key breakpoints in our grid system. /* Extra small devices (phones, less than 768px) */ /* No media query since this is the default in Bootstrap */ /* Small devices (tablets, 768px and up) */ @media (min-width: @screen-sm-min) ...
Turn any fixed-width grid layout into a full-width layout by changing your outermost .container to .container-fluid. <div class="container-fluid"> <div class="row"> ... </div> </div>
Easily change the order of our built-in grid columns with .col-md-push-* and .col-md-pull-* modifier classes. <div class="row"> <div class="col-md-9 col-md-push-3">.col-md-9 .col-md-push-3</div> <div class="col-md-3 col-md-pull-9">.col-md-...
Possessive quantifiers are another class of quantifiers in many regex flavours that allow backtracking to, effectively, be disabled for a given token. This can help improve performance, as well as preventing matches in certain cases. The class of possessive quantifiers can be distinguished from laz...
The following is a simple example Perl test script, that gives some structure to allow for testing of other methods in the class/package under test. The script produces standard output with simple "ok" / "not ok" text, which is called TAP (Test Anything Protocol). Typically the...
If you'd like to start implementing best practices, for yourself or your team, then Perl::Critic is the best place to start. The module is based on the Perl Best Practices book by Damien Conway and does a fairly good job implementing the suggestions made therein. Note: I should mention (and Conwa...
Type below command: instmodsh It'll show you the guild as below: Available commands are: l - List all installed modules m <module> - Select a module q - Quit the program cmd? Then type l to list all the installed modules, you can also use command m &l...
package main import ( "fmt" "k8s.io/client-go/1.5/kubernetes" "k8s.io/client-go/1.5/pkg/api/v1" "k8s.io/client-go/1.5/tools/clientcmd" ) func main() { config, err := clientcmd.BuildConfigFromFlags("", <kube-config-path&g...
IronPython enables to use generic classes and methods from the .net framework. Generics can be used with the same syntax as accessing an index. For passing more than one type-parameter, they must be separated with a comma: l = Dictionary[int, str]() That way we create a dictionary where keys on...
A literal inside a enumeration is a discrete type so we can use attribute Image to find out which literal it is as text form. Notice that this prints out the same word as in the code (but in upper case). with Ada.Text_IO; use Ada.Text_IO; procedure Main is type Fruit is (Banana, Pear, Orang...
Instead of attribute Image and Ada.Text_IO.Put on enumeration literals we can only use the generic package Ada.Text_IO.Enumeration_IO to print out the literals. with Ada.Text_IO; use Ada.Text_IO; procedure Main is type Fruit is (Banana, Pear, Orange, Melon); package Fruit_IO is new Enume...
Attribute Image capitalizes all characters of enumeration literals. The function Case_Rule_For_Names applies upper case for the first character and makes the rest lower case. with Ada.Text_IO; use Ada.Text_IO; with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; with Ada.Strings.Fixed...
// filter by creation date $date = new Zend_Date(); $toDate = $date->get(Zend_Date::W3C); // today $fromDate = $date->sub('1', Zend_Date::MONTH)->get(Zend_Date::W3C); // one month ago $orders->addAttributeToFilter('created_at', array('from' => $fromDate, 'to' => $toDate)); ...
Break regular string literals with the \ character let a = "foobar"; let b = "foo\ bar"; // `a` and `b` are equal. assert_eq!(a,b); Break raw-string literals to separate strings, and join them with the concat! macro let c = r"foo\bar"; let d = conca...
You might have realized that $emit is scoped to the component that is emitting the event. That's a problem when you want to communicate between components far from one another in the component tree. Note: In Vue1 you coud use $dispatch or $broadcast, but not in Vue2. The reason being that it doesn'...
This code places the hint text at form load and manipulates it as follows: C# private void Form_load(object sender, EventArgs e) { textBox.Text = "Place Holder text..."; } private void textBox_Enter(object sender, EventArgs e) { if(textBox.Text == "Place Holder text....

Page 259 of 417