> run
> fastOptJS
Generates a single JS file.
> fullOptJS
// 1. The signum of a number is 1 if the number is positive, -1 if it is negative, and | |
// 0 if it is zero. Write a function that computes this value. | |
def signum(n: Int) = { | |
if (n > 0) 1 | |
else if (n < 0) -1 | |
else 0 | |
} //> signum: (n: Int)Int | |
signum(4) //> res0: Int = 1 |
const app = new Vue({ | |
el: '#app', | |
data: { | |
product: 'Boots', | |
myproducts: [ | |
'Boots', | |
'Jacket', | |
'Hiking Socks' | |
], | |
products: [] |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.util.List; | |
import java.util.Random; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; | |
public class Sources { | |
public static void main(String[] args) throws IOException { |
public class Main { | |
enum Event { | |
PLAY, STOP, PAUSE | |
} | |
public static void main(String[] args) { | |
var event = Event.PLAY; | |
switch (event) { | |
case PLAY: |
docker pull postgres:latest | |
docker run -d --name guitar-db -p 5432:5432 -e 'POSTGRES_PASSWORD=p@ssw0rd42' postgres |
package src.exercises | |
import scala.math._ | |
import BigInt.probablePrime | |
import util.Random | |
object chap01 { | |
// 1. In the Scala REPL, type 3. followed by the Tab key. What methods can be | |
// applied? | |
// => Do it in REPL. There are many methods including %, &, *, +, toByte, toChar etc. |
// 1. Write a code snippet that sets a to an array of n random integers between 0 | |
// (inclusive) and n (exclusive). | |
val a = new Array[Int](10) //> a : Array[Int] = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | |
for(i <- 0 until a.length) a(i) = scala.util.Random.nextInt(10) | |
a //> res0: Array[Int] = Array(9, 0, 5, 8, 6, 6, 3, 9, 0, 3) | |
// 2. Write a loop that swaps adjacent elements of an array of integers. For example, | |
// Array(1, 2, 3, 4, 5) becomes Array(2, 1, 4, 3, 5). | |
val a = Array[Int](1,2,3,4,5) | |
a //> res1: Array[Int] = Array(1, 2, 3, 4, 5) |
npm init -y | |
npm install --save typescript | |
tsc --init |
'use strict'; | |
let lime = new function() { | |
this.type = 'Mexican lime'; | |
this.color = 'green'; | |
this.getInformation = function() { | |
return 'This ' + this.type + ' is ' + this.color + '.'; | |
}; | |
} |