Because a clack request is represented as a plist, we can use pattern matching as the entry point to the clack app as a way to route request to their appropriate controllers
(defvar *app*
(lambda (env)
(match env
((plist :request-method :get
:request-uri uri)
(...
Using pattern matching one can intertwine function definition and pattern matching, similar to SML.
(trivia:defun-match fib (index)
"Return the corresponding term for INDEX."
(0 1)
(1 1)
(index (+ (fib (1- index)) (fib (- index 2)))))
(fib 5)
;; => 8
With the case statement you can match values against one variable.
The argument passed to case is expanded and try to match against each patterns.
If a match is found, the commands upto ;; are executed.
case "$BASH_VERSION" in
[34]*)
echo {1..4}
;;
*)
seq -s" ...
The following are examples of how to install MIT/GNU Scheme:
Debian/Ubuntu installation:
sudo apt-get install mit-scheme
Manual installation:
Download the Unix binary directly from the GNU Project, then follow the instructions from the official webpage:
# Unpack the tar file
tar xzf mit-sche...
To add a method to a button, first create an action method:
Objective-C
-(void) someButtonAction{
NSLog(@"Button is tapped");
}
Swift
func someButtonAction() {
print("Button is tapped")
}
Now to add this action method to your button, you have to wri...
Fired when one or more of the component or directive properties have been changed.
import { Component, OnChanges, Input } from '@angular/core';
@Component({
selector: 'so-onchanges-component',
templateUrl: 'onchanges-component.html',
styleUrls: ['onchanges-component.']
})
class ...
Fire after the view has been fully initialized.
(Only available for components)
import { Component, AfterContentChecked } from '@angular/core';
@Component({
selector: 'so-aftercontentchecked-component',
templateUrl: 'aftercontentchecked-component.html',
styleUrls: ['aftercontentc...
Fire after the check of the view, of the component, has finished.
(Only available for components)
import { Component, AfterViewChecked } from '@angular/core';
@Component({
selector: 'so-afterviewchecked-component',
templateUrl: 'afterviewchecked-component.html',
styleUrls: ['afte...
Allows to listen for changes only on specified properties
import { Component, DoCheck, Input } from '@angular/core';
@Component({
selector: 'so-docheck-component',
templateUrl: 'docheck-component.html',
styleUrls: ['docheck-component.']
})
class DoCheckComponent implements DoChe...
1. Character Class
Character class is denoted by []. Content inside a character class is treated as single character separately. e.g. suppose we use
[12345]
In the example above, it means match 1 or 2 or 3 or 4 or 5 . In simple words, it can be understood as or condition for single characters (...
Pure JavaScript
It's possible to add, remove or change CSS property values with JavaScript through an element's style property.
var el = document.getElementById("element");
el.style.opacity = 0.5;
el.style.fontFamily = 'sans-serif';
Note that style properties are named in lower came...
ng-app Sets the AngularJS section.
ng-init Sets a default variable value.
ng-bind Alternative to {{ }} template.
ng-bind-template Binds multiple expressions to the view.
ng-non-bindable States that the data isn't bindable.
ng-bind-html Binds inner HTML property of an HTML element....
A Bag/ultiset stores each object in the collection together with a count of occurrences. Extra methods on the interface allow multiple copies of an object to be added or removed at once. JDK analog is HashMap<T, Integer>, when values is count of copies this key.
TypeGuavaApache Commons Collec...
This multimap allows duplicate key-value pairs. JDK analogs are HashMap<K, List>, HashMap<K, Set> and so on.
Key's orderValue's orderDuplicateAnalog keyAnalog valueGuavaApacheEclipse (GS) CollectionsJDKnot definedInsertion-orderyesHashMapArrayListArrayListMultimapMultiValueMapFastListMu...
Types of columns can be checked by .dtypes atrribute of DataFrames.
In [1]: df = pd.DataFrame({'A': [1, 2, 3], 'B': [1.0, 2.0, 3.0], 'C': [True, False, True]})
In [2]: df
Out[2]:
A B C
0 1 1.0 True
1 2 2.0 False
2 3 3.0 True
In [3]: df.dtypes
Out[3]:
A int64
...
astype() method changes the dtype of a Series and returns a new Series.
In [1]: df = pd.DataFrame({'A': [1, 2, 3], 'B': [1.0, 2.0, 3.0],
'C': ['1.1.2010', '2.1.2011', '3.1.2011'],
'D': ['1 days', '2 days', '3 days'],
...
You can search Docker Hub for images by using the search command:
docker search <term>
For example:
$ docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. ...
The following example creates a canvas with 2 points and 1 line in between.
You will be able to move the point and the line around.
from kivy.app import App
from kivy.graphics import Ellipse, Line
from kivy.uix.boxlayout import BoxLayout
class CustomLayout(BoxLayout):
def __init__(se...
The "factory default" number of worksheets created in a new Excel workbook is generally set to three. Your VBA code can explicitly set the number of worksheets in a new workbook.
'--- save the current Excel global setting
With Application
Dim oldSheetsCount As Integer
oldSheets...
Stackage is a repository for Haskell packages. We can add these packages to a stack project.
Adding lens to a project.
In a stack project, there is a file called stack.yaml. In stack.yaml there is a segment that looks like:
resolver: lts-6.8
Stackage keeps a list of packages for every revision...