Tutorial by Examples

To create a mixin use the @mixin directive. @mixin default-box ($color, $borderColor) { color: $color; border: 1px solid $borderColor; clear: both; display: block; margin: 5px 0; padding: 5px 10px; } You can specify a list of arguments inside a parenthesis followin...
string nullString = null; string emptyString = ""; string whitespaceString = " "; string tabString = "\t"; string newlineString = "\n"; string nonEmptyString = "abc123"; bool result; result = String.IsNullOrEmpty(nullString); ...
Declaring a generic interface interface IResult<T> { wasSuccessfull: boolean; error: T; } var result: IResult<string> = .... var error: string = result.error; Generic interface with multiple type parameters interface IRunnable<T, U> { run(input: T): U; } ...
class Result<T> { constructor(public wasSuccessful: boolean, public error: T) { } public clone(): Result<T> { ... } } let r1 = new Result(false, 'error: 42'); // Compiler infers T to string let r2 = new Result(false, 42); // Compiler infers T...
Simple constraint: interface IRunnable { run(): void; } interface IRunner<T extends IRunnable> { runSafe(runnable: T): void; } More complex constraint: interface IRunnble<U> { run(): U; } interface IRunner<T extends IRunnable<U>, U> { runSafe...
In interfaces: interface IRunner { runSafe<T extends IRunnable>(runnable: T): void; } In classes: class Runner implements IRunner { public runSafe<T extends IRunnable>(runnable: T): void { try { runnable.run(); } catch(e) { } ...
Create generic class instance: var stringRunnable = new Runnable<string>(); Run generic function: function runSafe<T extends Runnable<U>, U>(runnable: T); // Specify the generic types: runSafe<Runnable<string>, string>(stringRunnable); // Let typescript figu...
Using the mmap module allows the user to randomly access locations in a file by mapping the file into memory. This is an alternative to using normal file operations. import mmap with open('filename.ext', 'r') as fd: # 0: map the whole file mm = mmap.mmap(fd.fileno(), 0) # print ...
Prefabs are an asset type that allows the storage of a complete GameObject with its components, properties, attached components and serialized property values. There are many scenarios where this is useful, including: Duplicating objects in a scene Sharing a common object across multiple scenes ...
The view-model is the "VM" in MVVM. This is a class that acts as a go-between, exposes the model(s) to the user interface (view), and handling requests from the view, such as commands raised by button clicks. Here is a basic view-model: public class CustomerEditViewModel { /// <s...
The model is the first "M" in MVVM. The model is usually a class containing the data that you want to expose via some kind of user interface. Here is a very simple model class exposing a couple of properties:- public class Customer : INotifyPropertyChanged { private string _forenam...
The View is the "V" in MVVM. This is your user interface. You can use the Visual Studio drag-and-drop designer, but most developers eventually end up coding the raw XAML - an experience similar to writing HTML. Here is the XAML of a simple view to allow editing of a Customer model. Rather...
If you are familiar with jQuery and Sizzle syntax, d3 selections should not be much different. d3 mimics the W3C Selectors API to make interacting with elements easier. For a basic example, to select all <p> and add a change to each of them: d3.selectAll('p') .attr('class','textClass') ...
Signals and slots are used for communication between objects. The signals and slots mechanism is a central feature of Qt and probably the part that differs most from the features provided by other frameworks. The minimal example requires a class with one signal, one slot and one connection: counte...
The lubridate package provides convenient functions to format date and datetime objects from character strings. The functions are permutations of LetterElement to parseBase R equivalentyyear%y, %Ym (with y and d)month%m, %b, %h, %Bdday%d, %ehhour%H, %I%pm (with h and s)minute%Msseconds%S e.g. ymd(...
This will show the user type and permission path (which windows group the user is getting its permissions from). xp_logininfo 'DOMAIN\user'
You can alternatively use an Object Declaration that contains the main function for a Kotlin program. package my.program object App { @JvmStatic fun main(args: Array<String>) { println("Hello World") } } The class name that you will run is the name of you...
Similar to using an Object Declaration, you can define the main function of a Kotlin program using a Companion Object of a class. package my.program class App { companion object { @JvmStatic fun main(args: Array<String>) { println("Hello World") ...
TYPO3 Extbase extension development method came along with the release of TYPO3 4.3.0 in November 2009. Extbase is a PHP-based framework which supports developers in creating clean and easily maintainable TYPO3 extensions.The first real presentation of Extbase happened in April 2009 on the american ...
Haskell supports a notion of class extension. For example, the class Ord inherits all of the operations in Eq, but in addition has a compare function that returns an Ordering between values. Ord may also contain the common order comparison operators, as well as a min method and a max method. The =&...

Page 264 of 1336