Tutorial by Examples: c

Express is based on Connect, which is what provides the middleware functionality of Express. To understand what connect is, you can see that it provides the basic app structure that you use when you use express const connect = require('connect') const app = connect() app.listen(3000) This wi...
Use quasiquotes to create a Tree in a macro. object macro { def addCreationDate(): java.util.Date = macro impl.addCreationDate } object impl { def addCreationDate(c: Context)(): c.Expr[java.util.Date] = { import c.universe._ val date = q"new java.util.Date()" // this...
You can quit GHCi simply with :q or :quit ghci> :q Leaving GHCi. ghci> :quit Leaving GHCi. Alternatively, the shortcut CTRL+D (Cmd+D for OSX) has the same effect as :q.
Launch mode defines the behaviour of new or existing activity in the task. There are possible launch modes: standard singleTop singleTask singleInstance It should be defined in android manifest in <activity/> element as android:launchMode attribute. <activity android:launchM...
You can call an instance method using the . special form: (.trim " hello ") ;;=> "hello" You can call instance methods with arguments like this: (.substring "hello" 0 2) ;;=> "he"
You can call an instance field using the .- syntax: (def p (java.awt.Point. 0 1)) (.-x p) ;;=> 0 (.-y p) ;;=> 1
You can create instance of objects in one of two ways: (java.awt.Point. 0 1) ;;=> => #object[java.awt.Point 0x3776d535 "java.awt.Point[x=0,y=1]"] Or (new java.awt.Point 0 1) ;;=> => #object[java.awt.Point 0x3776d535 "java.awt.Point[x=0,y=1]"]
You can call static methods like this: (System/currentTimeMillis) ;;=> 1469493415265 Or pass in arguments, like this: (System/setProperty "foo" "42") ;;=> nil (System/getProperty "foo") ;;=> "42"
You can call a Clojure function from Java code by looking up the function and invoking it: IFn times = Clojure.var("clojure.core", "*"); times.invoke(2, 2); This looks up the * function from the clojure.core namespace and invokes it with the arguments 2 & 2.
The macro() function allows you to add new functionality to Illuminate\Support\Collection objects Usage: Collection::macro("macro_name", function ($parameters) { // Your macro }); For example: Collection::macro('uppercase', function () { return $this->map(function ($i...
Also known as triple equals. This operator does not test equality, but rather tests if the right operand has an IS A relationship with the left operand. As such, the popular name case equality operator is misleading. This SO answer describes it thus: the best way to describe a === b is "if I ...
Goto https://atom.io/ and install the atom editor. Then install some Atom packages for easier Titanium coding: NameTypeFeaturestitanium language javascriptLanguageJS Autocomplete (non alloy)Titanium Alloyadd-onAll-in-one packageJump to definitionOpen relatedTSS HighlightTi-Createadd-onCreate proje...
We are just creating an empty Alloy app using CLI and Atom. Open a new terminal and add the following: ti create --id com.test -d . -n APPNAME -p all -t app -u http://migaweb.de cd APPNAME/ alloy new This will create a basic app (name: APPNAME, bundle identifier: com.test, type: app, platform...
There are several ways to compile your app. You can use the simulator/emulator, deploy it to your device or create store apk's/ipa's. There is also a live test tool (TiShadow) which saves you a lot of time waiting for the compiler. cli way # android to device ti build -p android -T device # a...
Contains the subpattern from the corresponding set of parentheses in the last successful pattern matched, not counting patterns matched in nested blocks that have been exited already, or nil if the last pattern match failed. These variables are all read-only.
Modules can contain other modules and classes: module Namespace module Child class Foo; end end # module Child # Foo can now be accessed as: # Child::Foo end # module Namespace # Foo must now be accessed as: # Namespace::Child::Foo
To create a gemset we need to create a .rvmrc file. Syntax: $ rvm --rvmrc --create <ruby-version>@<gemsetname> Example: $ rvm --rvmrc --create ruby-2.2.2@myblog The above line will create a .rvmrc file in the root directory of the app. To get the list of available gemsets, us...
The permutation method, when called with a block yields a two dimensional array consisting of all ordered sequences of a collection of numbers. If this method is called without a block, it will return an enumerator. To convert to an array, call the to_a method. ExampleResult[1,2,3].permutation#&lt...
DatabaseTransactions trait allows databases to rollback all the change during the tests. If you want to rollback multiple databases , you need to set $connectionsToTransact properties use Illuminate\Foundation\Testing\DatabaseMigrations; class ExampleTest extends TestCase { use Databas...
let configuration = WKWebViewConfiguration() if let path = NSBundle.mainBundle().pathForResource("customUserScript", ofType: "js"), source = try? NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding) as String { let userScript = WKUserScript(source...

Page 337 of 826