Tutorial by Examples: active

<?php echo esc_url( get_bloginfo( 'stylesheet_directory' ) ); ?> Output http://example.com/wp-content/themes/twentysixteen Alternatives Internally, get_bloginfo( 'stylesheet_directory' ) calls get_stylesheet_directory_uri(), so you may want to use that instead: <?php echo esc_url( ...
git add -i (or --interactive) will give you an interactive interface where you can edit the index, to prepare what you want to have in the next commit. You can add and remove changes to whole files, add untracked files and remove files from being tracked, but also select subsection of changes to put...
Note that these only work in the developer tools of certain browsers. $_ gives you the value of whatever expression was evaluated last. "foo" // "foo" $_ // "foo" $0 refers to the DOM element currently selected in the Inspector. So if &l...
Active patterns are a special type of pattern matching where you can specify named categories that your data may fall into, and then use those categories in match statements. To define an active pattern that classifies numbers as positive, negative or zero: let (|Positive|Negative|Zero|) num = ...
This example aims to describe how one can utilize git rebase in interactive mode. It is expected that one has a basic understanding of what git rebase is and what it does. Interactive rebase is initiated using following command: git rebase -i The -i option refers to interactive mode. Using inte...
You have started an interactive rebase. In the editor where you pick your commits, you decide that something is going wrong (for example a commit is missing, or you chose the wrong rebase destination), and you want to abort the rebase. To do this, simply delete all commits and actions (i.e. all lin...
Option Explicit Sub LoopAllSheets() Dim sht As Excel.Worksheet ' declare an array of type String without committing to maximum number of members Dim sht_Name() As String Dim i As Integer ' get the number of worksheets in Active Workbook , and put it as the maximum number of members in t...
To run a container interactively, pass in the -it options: $ docker run -it ubuntu:14.04 bash root@8ef2356d919a:/# echo hi hi root@8ef2356d919a:/# -i keeps STDIN open, while -t allocates a pseudo-TTY.
<?php namespace models; use yii\db\ActiveRecord; use yii\behaviors\TimestampBehavior; class Post extends ActiveRecord { public static function tableName() { return 'post'; } public function rules() { ...
vimtutor is an interactive tutorial covering the most basic aspects of text editing. On UNIX-like system, you can start the tutorial with: $ vimtutor On Windows, “Vim tutor” can be found in the “Vim 7.x” directory under “All Programs” in the Windows menu. See :help vimtutor for further details...
You can validate any object, even plain ruby. class User include ActiveModel::Validations attr_reader :name, :age def initialize(name, age) @name = name @age = age end validates :name, presence: true validates :age, numericality: { only_integer: true, greater_than...
Using ActiveCell or ActiveSheet can be source of mistakes if (for any reason) the code is executed in the wrong place. ActiveCell.Value = "Hello" 'will place "Hello" in the cell that is currently selected Cells(1, 1).Value = "Hello" 'will always place "Hello&...
F# Interactive, is a REPL environment that lets you execute F# code, one line at a time. If you have installed Visual Studio with F#, you can run F# Interactive in console by typing "C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0\Fsi.exe". On Linux or OS X, the command is fsh...
If you want to mock AR that doesn't try to connect to database you can do it in the following way (if using PHPUnit): $post = $this->getMockBuilder('\app\model\Post') ->setMethods(['save', 'attributes']) ->getMock(); $post->method('save')->willReturn(true); $post->meth...
Active patterns are just simple functions. Like functions you can define additional parameters: let (|HasExtension|_|) expected (uri : string) = let result = uri.EndsWith (expected, StringComparison.CurrentCultureIgnoreCase) match result with | true -> Some true | _ -> N...
The plotly package allows many kind of interactive plots, including maps. There are a few ways to create a map in plotly. Either supply the map data yourself (via plot_ly() or ggplotly()), use plotly's "native" mapping capabilities (via plot_geo() or plot_mapbox()), or even a combination o...
A template autorun may be used to (re)subscribe to a publication. It establishes a reactive context which is re-executed whenever any reactive data it depends on changes. In addition, an autorun always runs once (the first time it is executed). Template autoruns are normally put in an onCreated met...
Stashing takes the dirty state of your working directory – that is, your modified tracked files and staged changes – and saves it on a stack of unfinished changes that you can reapply at any time. Stashing only modified files: Suppose you don't want to stash the staged files and only stash the mod...
If you need an ActiveRecord method to raise an exception instead of a false value in case of failure, you can add ! to them. This is very important. As some exceptions/failures are hard to catch if you don't use ! on them. I recommended doing this in your development cycle to write all your ActiveRe...
If you need to search an ActiveRecord model for similar values, you might be tempted to use LIKE or ILIKE but this isn't portable between database engines. Similarly, resorting to always downcasing or upcasing can create performance issues. You can use ActiveRecord's underlying Arel matches method...

Page 1 of 4