Tutorial by Examples

Request tests are end to end tests that imitate the behavior of a user. it 'allows the user to set their preferences' do check 'Ruby' click_on 'Save and Continue' expect(user.languages).to eq ['Ruby'] end source This kind of test focuses on user flows and runs through all layers of th...
get_option function is used to retrieve a value from from options table based on option name. You can use the following code to get email address of a WordPress site administrator. <?php echo get_option('admin_email'); ?> get_option() has an optional 2nd argument, which allows you to set ...
We can use the get_bloginfo function to retrieve the email address of the site administrator. <?php echo get_bloginfo('admin_email'); ?>
To create a Hello World plug-in for Eclipse, click: File ➜ New ➜ Other... Select Plug-in Project and click Next > The New Plug-in Project wizard will guide you through the options for creating a new plug-in. Enter a project name (like HelloWorld), and click Next > On the Content pag...
For a non-main packages as well as main, instead of adding flags inside the code, write benchmarks in the test package , for example: func BenchmarkHello(b *testing.B) { for i := 0; i < b.N; i++ { fmt.Sprintf("hello") } } Then run the test with the profile flag ...
once a prof file has been generated, one can access the prof file using go tools: go tool pprof cpu.prof This will enter into a command line interface for exploring the profile Common commands include: (pprof) top lists top processes in memory (pprof) peek Lists all processes, use reg...
app/controllers/myname.js app/templates/myname.hbs app/routes/myname.js app/models/myname.js Using pods, the example above would translate into this: app/myname/controller.js app/myname/template.hbs app/myname/route.js app/myname/model.js
ember generate route foo --pod installing create app/pods/foo/route.js create app/pods/foo/template.hbs installing create tests/unit/pods/foo/route-test.js
var gulp = require('gulp'); // include plug-ins var uglify = require('gulp-uglify'), concat = require('gulp-concat'); // Minified file gulp.task('packjsMin', function() { return gulp.src('node_modules/angular/*.js') .pipe(concat('script.js')) .pipe(uglify()) .p...
Printing "hello world" on several languages on Maya on the console (Script Editor). MEL On a MEL tab on the Script Editor, or the command line bar, selecting MEL: print ("hello world"); And hit play on the script editor or enter key on the command line. PYTHON On a Python...
There are a few ways to setup a local copy of your Shopify theme: Node.js ( gulp/grunt ) Ruby Theme App ( Mac only ) There might be a few other ways, but I found the ruby way the most easy to work with. In order to work locally on the Shopify theme files you will need a few things: Ruby ...
You can use docker, without using docker daemon (engine), by using cloud providers. In this example, you should have a gcloud (Google Cloud util), that connected to your account docker-machine create --driver google --google-project `your-project-name` google-machine-type f1-large fm02 This exa...
grant all privileges on schema_name.* to 'new_user_name'@'%' identified by 'newpassword'; Attention: This can be used to create new root user
rename user 'user'@'%' to 'new_name`@'%'; If you create a user by mistake, you can change his name
DROP TABLE Database.table_name
Given an m times n matrix A with n larger than m. The singular value decomposition [U,S,V] = svd(A); computes the matrices U,S,V. The matrix U consists of the left singular eigenvectors which are the eigenvectors of A*A.' while V consists of the right singular eigenvalues which are the eigenvec...
You might receive from your peer private key in PPK format, which seems it does not work in OpenSSH (command-line ssh). The client will be asking for the passphrase, because of OpenSSH bug. $ ssh -i mykey.ppk example.com Enter passphrase for mykey.ppk: You need to convert the key to OpenSSH for...
Visual Basic.NET, like most languages, permits recursion, a process by which a function calls itself under certain conditions. Here is a basic function in Visual Basic .NET to compute Fibonacci numbers. ''' <summary> ''' Gets the n'th Fibonacci number ''' </summary> ''' <param na...
Template Generic Syntax template<typename T> void f(ParamType param); f(expr); Case 1: ParamType is a Reference or Pointer, but not a Universal or Forward Reference. In this case type deduction works this way. The compiler ignores the reference part if it exists in expr. The compiler t...
C++11 Type deduction using the auto keyword works almost the same as Template Type Deduction. Below are a few examples: auto x = 27; // (x is neither a pointer nor a reference), x's type is int const auto cx = x; // (cx is neither a pointer nor a reference), cs's type is const int ...

Page 1026 of 1336