Tutorial by Examples: st

package main import ( "log" "text/template" "os" ) type Person struct{ MyName string MyAge int } var myTempContents string= ` This person's name is : {{.MyName}} And he is {{.MyAge}} years old. ` func main() { t,err := temp...
You can nest quotes simply by including multiple > characters, like so: > Often makes no sense. > > Commenting above your quote… Often makes no sense. Commenting above your quote…
You can group multiple boolean logic statements within parenthesis in order to create a more complex logic evaluation, especially useful in if statements. if ((age >= 18 && height >= 5.11) || (status === 'royalty' && hasInvitation)) { console.log('You can enter our club'); ...
__call() and __callStatic() are called when somebody is calling nonexistent object method in object or static context. class Foo { /** * This method will be called when somebody will try to invoke a method in object * context, which does not exist, like: * * $foo->...
Blade provides convenient syntax for common PHP control structures. Each of the control structures begins with @[structure] and ends with @[endstructure]. Notice that within the tags, we are just typing normal HTML and including variables with the Blade syntax. Conditionals 'If' statements @if...
The most "popular" way of reversing a string in JavaScript is the following code fragment, which is quite common: function reverseString(str) { return str.split('').reverse().join(''); } reverseString('string'); // "gnirts" However, this will work only so long as ...
In case you have a Named Range in your Sheet, and you want to dynamically get the last row of that Dynamic Named Range. Also covers cases where the Named Range doesn't start from the first Row. Sub FindingLastRow() Dim sht As Worksheet Dim LastRow As Long Dim FirstRow As Long Set sht =...
After extending the Http class, we need to tell angular to use this class instead of Http class. In order to do this, in our main module(or depending on the needs, just a particular module), we need to write in the providers section: export function httpServiceFactory(xhrBackend: XHRBackend, reque...
A simple type switch: // assuming x is an expression of type interface{} switch t := x.(type) { case nil: // x is nil // t will be type interface{} case int: // underlying type of x is int // t will be int in this case as well case string: // underlying type of x is st...
It is possible to create a function that accepts objects that implement a specific trait. Static Dispatch fn generic_speak<T: Speak>(speaker: &T) { println!("{0}", speaker.speak()); } fn main() { let person = Person {}; let dog = Dog {}; generic_speak(...
Objects will often depend on other objects. Instead of creating the dependency in the constructor, the dependency should be passed into the constructor as a parameter. This ensures there is not tight coupling between the objects, and enables changing the dependency upon class instantiation. This has...
Detailed instructions on getting spring-security set up or installed.
Note: GRAILS requires a Java JDK installed (a runtime environment JRE is not sufficient) on your system, before setting up Grails. Please refer to, how to install JDK. As of this writing, it is recommended to install the latest JDK. For Mac OSX, Linux, Cygwin, Solaris and FreeBSD: The simplest w...
Putting a & (ampersand) in front of an argument will pass it as the method's block. Objects will be converted to a Proc using the to_proc method. class Greeter def to_proc Proc.new do |item| puts "Hello, #{item}" end end end greet = Greeter.new %w(world l...
In this approach, the single is accessed via the static method: Singleton.getInstance(); To enforce only one instance of the singleton, a private static variable retains the instance, while any additional attempts to instantiate an instance are enforced within the constructor. package { publ...
Cocoa is Apple's API to develop apps for macOS, formerly known as OS X. Cocoa is a container framework, and contains three sub-frameworks. Foundation AppKit CoreData Cocoa Touch is Apple's version of Cocoa to develop apps for iOS, watchOS and tvOS. Cocoa Touch contains the same sub-framewo...
Save the current state of working directory and the index (also known as the staging area) in a stack of stashes. git stash To include all untracked files in the stash use the --include-untracked or -u flags. git stash --include-untracked To include a message with your stash to make it more ...
git stash list This will list all stashes in the stack in reverse chronological order. You will get a list that looks something like this: stash@{0}: WIP on master: 67a4e01 Merge tests into develop stash@{1}: WIP on master: 70f0d95 Add user role to localStorage on user login You can refer t...
Shows the changes saved in the last stash git stash show Or a specific stash git stash show stash@{n} To show content of the changes saved for the specific stash git stash show -p stash@{n}
Remove all stash git stash clear Removes the last stash git stash drop Or a specific stash git stash drop stash@{n}

Page 49 of 369