Tutorial by Examples: 0

If you want to automatically throw an exception when searching for a record that isn't found on a modal, you can use either Vehicle::findOrFail(1); or Vehicle::where('make', 'ford')->firstOrFail(); If a record with the primary key of 1 is not found, a ModelNotFoundException is thrown. W...
Note: Before upgrading your Rails app, always make sure to save your code on a version control system, such as Git. To upgrade from Rails 4.2 to Rails 5.0, you must be using Ruby 2.2.2 or newer. After upgrading your Ruby version if required, go to your Gemfile and change the line: gem 'rails', '...
'use strict'; // This is an example of a /api/controllers/HomeController.js module.exports = { // This is the index action and the route is mapped via /config/routes.js index(req, res) { // Return a view without view model data // This typically will return the view defined at /v...
'use strict'; const co = require('co'); module.exports = { // This is the index action and the route is mapped via /config/routes.js index(req, res) { co(function* index() { // Return a view without view model data // This typically will return the view defined at /vie...
When checking if a string is zero-length, it is better practice, and more efficient, to inspect the length of the string rather than comparing the string to an empty string. Const myString As String = vbNullString 'Prefer this method when checking if myString is a zero-length string If Len(mySt...
<svg width="900px" height="400px" viewBox="900 400"> <defs> <filter id="GaussianHardEdge" x="0%" y="0%" width="100%" height="100%"> <feGaussianBlur stdDeviation="5"/&gt...
perl -ne'print if 5..10' file.txt
In SQL Server 2016 finally they have introduced Split string function : STRING_SPLIT Parameters: It accepts two parameters String: Is an expression of any character type (i.e. nvarchar, varchar, nchar or char). separator : Is a single character expression of any character type (e.g. nv...
In some cases the behavior of a command depends on whether it is given branch name, tag name, or an arbitrary revision. You can use "de-referencing" syntax if you need the latter. A suffix ^ followed by an object type name (tag, commit, tree, blob) enclosed in brace pair (for example v0.9...
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...
Fetching resources over the network is both slow and expensive: the download may require multiple roundtrips between the client and server, which delays processing and may block rendering of page content, and also incurs data costs for the visitor. All server responses should specify a caching p...
Step 1: Create a new Rails app gem install rails -v 4.1 rails new angular_example Step 2: Remove Turbolinks Removing turbolinks requires removing it from the Gemfile. gem 'turbolinks' Remove the require from app/assets/javascripts/application.js: //= require turbolinks Step 3: Add Angu...
Option Base is used to declare the default lower bound of array elements. It is declared at module level and is valid only for the current module. By default (and thus if no Option Base is specified), the Base is 0. Which means that the first element of any array declared in the module has an index...
Contains the name of the script being executed. Is the same as __FILE__ if you are executing that script.
The first element of sys.argv[0] is the name of the python file being executed. The remaining elements are the script arguments. # script.py import sys print(sys.argv[0]) print(sys.argv) $ python script.py => script.py => ['script.py'] $ python script.py fizz => script.py ...
Introduction Unity has a few 'specially named' folders that allows for a variety of uses. One of these folders is called 'Resources' The 'Resources' folder is one of only TWO ways of loading assets at runtime in Unity (The other being AssetBundles (Unity Docs) The 'Resources' folder can reside an...
XAML controls may have dependency properties that can be bound to objects from DataContext or other controls. When the type of the object being bound is different from the type of the target DependencyProperty, a converter may be used to adapt one type to another. Converters are classes implementin...
https://github.com/jaymedavis/stripe.net is a great starting point. Assuming you are using MVC w/Razor you need to have a few things in your View page <script type="text/javascript" src="https://js.stripe.com/v2/"></script> This script calls upon the stripe.js t...
root: build.gradle buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle-experimental:0.8.0-alpha4' } } allprojects { repositories { jcenter() } } app: build.gradle apply plugin: 'com.andro...

Page 3 of 11