Tutorial by Examples: du

For a function or subroutine to be useful it has to be referenced. A subroutine is referenced in a call statement call sub(...) and a function within an expression. Unlike in many other languages, an expression does not form a complete statement, so a function reference is often seen in an ass...
Like the built-in python interactive shell, IPython is a REPL (Read-Evaluate-Print Loop) shell, with a variety of features that make it more pleasant to use for day-to-day Python development than the built-in REPL shell. Installation To install it: pip install ipython Or, via Anaconda: # To i...
ScriptableObjects are serialized objects that are not bound to scenes or gameobjects as MonoBehaviours are. To put it one way, they are data and methods bound to asset files inside your project. These ScriptableObject assets can be passed to MonoBehaviours or other ScriptableObjects, where their pub...
While redux itself is entirely synchronous, you can use a middleware such as redux-thunk to handle asynchronous actions. A "thunk" is another name for a callback. It is a function that is usually passed as an argument to be called at a later time. To use, apply the middleware to you...
const loadUser = userId => dispatch => { dispatch({ type: 'USER_LOADING' }); $.ajax('/users/' + userId, { type: 'GET', dataType : 'json' }).done(response => { dispatch({ type: 'USER_LOADED', user: response }); }).fail((xhr, status, error) =>...
Protocols enable polymorphism in Elixir. Define protocols with defprotocol: defprotocol Log do def log(value, opts) end Implement a protocol with defimpl: require Logger # User and Post are custom structs defimpl Log, for: User do def log(user, _opts) do Logger.info "User: ...
The contents of files and network messages may represent encoded characters. They often need to be converted to unicode for proper display. In Python 2, you may need to convert str data to Unicode characters. The default ('', "", etc.) is an ASCII string, with any values outside of ASCII ...
If you have any exposure to other text-based template languages, such as Smarty, Django, or Jinja, you should feel right at home with Twig. It's both designer and developer friendly by sticking to PHP's principles and adding functionality useful for templating environments. The key-features are... ...
Behaviours are a list of functions specifications that another module can implement. They are similar to interfaces in other languages. Here’s an example behaviour: defmodule Parser do @callback parse(String.t) :: any @callback extensions() :: [String.t] end And a module that implements ...
Types can represents various kind of things. It can be a single data, a set of data or a function. In F#, we can group the types into two categories.: F# types: // Functions let a = fun c -> c // Tuples let b = (0, "Foo") // Unit type let c = ignore // Records...
Like in many other languages, Python uses the % operator for calculating modulus. 3 % 4 # 3 10 % 2 # 0 6 % 4 # 2 Or by using the operator module: import operator operator.mod(3 , 4) # 3 operator.mod(10 , 2) # 0 operator.mod(6 , 4) # 2 You can also use negative nu...
from module.submodule import function This imports function from module.submodule.
To generate documentation in HTML format from @doc and @moduledoc attributes in your source code, add ex_doc and a markdown processor, right now ExDoc supports Earmark, Pandoc, Hoedown and Cmark, as dependencies into your mix.exs file: # config/mix.exs def deps do [{:ex_doc, "~> 0.11&...
Use defdelegate to define functions that delegate to functions of the same name defined in another module: defmodule Math do defdelegate pi, to: :math end iex> Math.pi 3.141592653589793
iex> :observer.start :ok :observer.start opens the GUI observer interface, showing you CPU breakdown, memory usage, and other information critical to understanding the usage patterns of your applications.
The reduce method reduces the collection to a single value, passing the result of each iteration into the subsequent iteration. Please see reduce method. The reduce method loops through each item with a collection and produces new result to the next iteration. Each result from the last iteration ...
Sometimes you may want maintain versions of a git repository on machines that have no network connection. Bundles allow you to package git objects and references in a repository on one machine and import those into a repository on another. git tag 2016_07_24 git bundle create changes_between_tags...
The Ionic Platform offers a range of powerful, hybrid-focused mobile backend services and tools to make it easy to scale beautiful, performant hybrid apps, at a rapid pace. In order to use Ionic Platform you need to have the Ionic Framework installed. 1.) Registration (sign-up) You need to enter...
var regExp = new RegExp(r"(\w+)"); var str = "Parse my string"; Iterable<Match> matches = regExp.allMatches(str); It's a good idea to use "raw strings" (prefix with r) when writing regular expressions so you can use unescaped backslashes in your expression. ...
1.8 Run: $ git mv old/path/to/module new/path/to/module 1.8 Edit .gitmodules and change the path of the submodule appropriately, and put it in the index with git add .gitmodules. If needed, create the parent directory of the new location of the submodule (mkdir -p new/path/to). M...

Page 15 of 47