Tutorial by Examples

Contains the name of the script being executed. Is the same as __FILE__ if you are executing that script.

$$

The process number of the Ruby running this script
Contains the subpattern from the corresponding set of parentheses in the last successful pattern matched, not counting patterns matched in nested blocks that have been exited already, or nil if the last pattern match failed. These variables are all read-only.
Command line arguments given for the script. The options for Ruby interpreter are already removed.
The standard input. The default value for $stdin
The standard output. The default value for $stdout
The standard error output. The default value for $stderr
The current standard error output.
The current standard output
The current standard input

ENV

The hash-like object contains current environment variables. Setting a value in ENV changes the environment for child processes.
Modules can contain other modules and classes: module Namespace module Child class Foo; end end # module Child # Foo can now be accessed as: # Child::Foo end # module Namespace # Foo must now be accessed as: # Namespace::Child::Foo
To create a gemset we need to create a .rvmrc file. Syntax: $ rvm --rvmrc --create <ruby-version>@<gemsetname> Example: $ rvm --rvmrc --create ruby-2.2.2@myblog The above line will create a .rvmrc file in the root directory of the app. To get the list of available gemsets, us...
This code opens a file for writing. Returns an error if the file couldn't be opened. Also closes the file at the end. #!/usr/bin/perl use strict; use warnings; use open qw( :encoding(UTF-8) :std ); # Make UTF-8 default encoding # Open "output.txt" for writing (">") and ...
The permutation method, when called with a block yields a two dimensional array consisting of all ordered sequences of a collection of numbers. If this method is called without a block, it will return an enumerator. To convert to an array, call the to_a method. ExampleResult[1,2,3].permutation#&lt...
Example Podfile: target 'MyProject' do pod 'AWSS3' pod 'RealmSwift' end and if you wanted to remove RealmSwift, remove that line from your Podfile target 'MyProject' do pod 'AWSS3' end then from the command line run $ pod install and CocoaPods will remove RealmSwift.
DatabaseTransactions trait allows databases to rollback all the change during the tests. If you want to rollback multiple databases , you need to set $connectionsToTransact properties use Illuminate\Foundation\Testing\DatabaseMigrations; class ExampleTest extends TestCase { use Databas...
let configuration = WKWebViewConfiguration() if let path = NSBundle.mainBundle().pathForResource("customUserScript", ofType: "js"), source = try? NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding) as String { let userScript = WKUserScript(source...
Messages can be sent from JavaScript using the following code window.webkit.messageHandlers.{NAME}.postMessage() Here how to create a script message handler to handle the messages: class NotificationScriptMessageHandler: NSObject, WKScriptMessageHandler { func userContentController(userCon...
function createGoogleDriveFileOfMimeType() { var content,fileName,newFile;//Declare variable names fileName = "Test File " + new Date().toString().slice(0,15);//Create a new file name with date on end content = "This is the file Content"; newFile = DriveApp.cre...

Page 543 of 1336