Tutorial by Examples: o

Contains the name of the script being executed. Is the same as __FILE__ if you are executing that script.
Command line arguments given for the script. The options for Ruby interpreter are already removed.
The standard output. The default value for $stdout
The current standard output
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...
function createGoogleDriveTextFile() { var content,fileName,newFile;//Declare variable names fileName = "Test Doc " + new Date().toString().slice(0,15);//Create a new file name with date on end content = "This is the file Content"; newFile = DriveApp.createFile...
function createGoogleDriveFileWithBlob() { var blob,character,data,fileName,i,L,max,min,newFile,randomNmbr;//Declare variable names fileName = "Test Blob " + new Date().toString().slice(0,15);//Create a new file name with date on end L = 500;//Define how many times to loo...
function processGoogleDriveFolders() { var arrayAllFolderNames,continuationToken,folders,foldersFromToken,thisFolder;//Declare variable names arrayAllFolderNames = [];//Create an empty array and assign it to this variable name folders = DriveApp.getFolders();//Get all folders from ...
function processGoogleDriveFiles() { var arrayAllFileNames,continuationToken,files,filesFromToken,fileIterator,thisFile;//Declare variable names arrayAllFileNames = [];//Create an empty array and assign it to this variable name files = DriveApp.getFiles();//Get all files from Googl...
function DriveAppAddFolder(child) {//Adds file to the root drive in Google Drive var body,returnedFolder;//Declare variable names if (!child) { body = "There is no folder"; MailApp.sendEmail(Session.getEffectiveUser().getEmail(), "", "Error Adding Folder!&q...
function DriveAppAddFile(child) {//Adds file to the root drive in Google Drive var body,returnedFolder;//Declare variable names if (!child) { body = "There is no file"; MailApp.sendEmail(Session.getEffectiveUser().getEmail(), "", "Error Adding File!",...
Suppose we want to select a word without surrounding white spaces, use the text object iw for inner word using visual mode: Got to normal mode by pressing ESC Type viw at the beginning of a word This will select the inner word

Page 412 of 1038