Tutorial by Examples: pre

From highest to lowest, this is the precedence table for Ruby. High precedence operations happen before low precedence operations. ╔═══════════════════════╦════════════════════════════════════════╦═════════╗ ║ Operators ║ Operations ║ Method? ║ ╠═══════════...
Javascript engines first look for variables within the local scope before extending their search to larger scopes. If the variable is an indexed value in an array, or an attribute in an associative array, it will first look for the parent array before it finds the contents. This has implications wh...
Until recently, using android.support.v4.app.FragmentPagerAdapter would prevent the usage of a PreferenceFragment as one of the Fragments used in the FragmentPagerAdapter. The latest versions of the support v7 library now include the PreferenceFragmentCompat class, which will work with a ViewPager ...
To run a script when multiple keys are pressed use the & between the keys. Numpad0 & Numpad1:: MsgBox You pressed 0 and 1 return
If a line approaches the maximum character limit, always consider breaking it down into multiple statements / expressions instead of wrapping the line. Break before operators. Break before the . in chained method calls. popupMsg("Inbox notification: You have " + newMsgs + &...
Runnable r = () -> System.out.println("Hello World"); Supplier<String> c = () -> "Hello World"; // Collection::contains is a simple unary method and its behavior is // clear from the context. A method reference is preferred here. appendFilter(goodStrings::cont...
First, here's what can happen when text/template is used for HTML. Note Harry's FirstName property). package main import ( "fmt" "html/template" "os" ) type Person struct { FirstName string LastName string Street string Cit...
Enabling gzip compression can reduce the size of the transferred response by up to 90%, which can significantly reduce the amount of time to download the resource, reduce data usage for the client, and improve the time to first render of your pages. — PageSpeed Insights Compression can be ena...
Define Interface public interface ClickHandler { public void onButtonClick(User user); } Create Model class public class User { private String name; public User(String name) { this.name = name; } public String getName() { return name; } ...
PhpStorm already ships with a lot of predefined language schemes that are based on common code style guidelines and standards like PSR-2. There is kind of a hidden feature in the code style settings pages where you can import these standards and set them as your current configuration. To do so simp...
Instead of var component = <Component foo={this.props.x} bar={this.props.y} />; Where each property needs to be passed as a single prop value you could use the spread operator ... supported for arrays in ES6 to pass down all your values. The component will now look like this. var compon...
This solution uses the ora:tokenize XQuery function that is available from Oracle 11. Sample Data: CREATE TABLE table_name ( id, list ) AS SELECT 1, 'a,b,c,d' FROM DUAL UNION ALL -- Multiple items in the list SELECT 2, 'e' FROM DUAL UNION ALL -- Single item in the list SELECT 3, NULL ...
Prevent access to your .htaccess file <Files .htaccess> order allow,deny deny from all </Files> # Rename the file AccessFileName thehtfile.ess Prevent URL attacks # Enable rewrites RewriteEngine On # Block <script> tags from executing in the URL RewriteCond %{QUE...
$ cat ip.txt address range substitution pattern sample Add Sub Mul Div Lines matching a pattern $ sed '/add/d' ip.txt range substitution pattern sample Add Sub Mul Div $ sed -n '/t/p' ip.txt substitution pattern $ sed -n '/[A-Z]/ s| |/|gp' ip.txt Add/Sub/Mul/Div ...
Using some setters, without setting all needed properties in the constructor(s) public final class Person { // example of a bad immutability private final String name; private final String surname; public Person(String name) { this.name = name; } public String ge...
If you are unsure which rules to list in your .gitignore file, or you just want to add generally accepted exceptions to your project, you can choose or generate a .gitignore file: https://www.toptal.com/developers/gitignore https://github.com/github/gitignore Many hosting services such as Git...
Monotonic predicates can be debugged by applying declarative reasoning. In pure Prolog, a programming mistake can lead to one or all of the following phenomena: the predicate incorrectly succeeds in a case where it should fail the predicate incorrectly fails in a case where it should succeed t...
Examples of monotonic predicates are: unification with (=)/2 or unify_with_occurs_check/2 dif/2, expressing disequality of terms CLP(FD) constraints like (#=)/2 and (#>)/2, using a monotonic execution mode. Prolog predicates that only use monotonic goals are themselves monotonic. Monoton...
Here are examples of predicates that are not monotonic: meta-logical predicates like var/1, integer/1 etc. term comparison predicates like (@<)/2 and (@>=)/2 predicates that use !/0, (\+)/1 and other constructs that break monotonicity all-solutions predicates like findall/3 and setof/3. ...
Adding a footer is not natively possible. Luckily, we can make use of jQuery and CSS to add a footer to the slides of an ioslides presentation rendered with knitr. First of all we have to include the jQuery plugin. This is done by the line <script src="https://ajax.googleapis.com/ajax/libs...

Page 14 of 34