View some.scala
$ brew cask install java8
==> installer: Package name is JDK 8 Update 152
==> installer: Installing at base path /
==> installer: The install was successful.
🍺 java8 was successfully installed!
$ jenv versions
oracle64-1.8.0.152 added
1.8.0.152 added
1.8 added
View ArrayToTree.js
class Node {
constructor() {
this.left = null;
this.right = null;
this.data = 0;
}
printInOrder() {
if (this.left !== null) {
this.left.printInOrder();
}
View PredicateExample.java
import java.util.List;
import java.util.ArrayList;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static java.lang.System.out;
public class PredicateExample {
enum Sex {
MALE("Male"), FEMALE("Female");
String sex;
Sex(String sex) {
View w1ex1
// Write a function called billTotal that can be used to calculate the total
// to be paid at a restaurant -- including tip and tax -- given the subtotal
// (i.e. cost of food and drinks). We can assume that the tip will be 15% and
// tax will be 9.5%. Make sure that the tip does not include the tax!
function billTotal(subtotal) {
var tax = 0.095;
var tip = 0.15;
var tot = (subtotal * tip) + (subtotal * tax) + subtotal;
console.log('1. ' + tot);
tot = Math.floor( (100 * tot) + 0.5) / 100;
View chart of Fibonicci numbers
// chart of Fibonicci numbers
// fib(6): 1 1 2 3 5 8 13
// | | | | | | |
// n: 0 1 2 3 4 5 6
View more_cities.clj
(def cities {
:germany ["Berlin" "Frankfurt" "Munich" "Bremerhaven" "Hamburg" "Leipzig"]
:france ["Paris" "Nice" "Marsaille" "Chartres" "Strasbourg" "Bordeaux"]
:italy ["Rome" "Naples" "Florence" "Milan" "Venice" "Genoa" "Bologna"]})
(defn countrys_cities [country] (country cities))
(println "\n* (doseq [item (countrys_cities :germany)] (println item))")
(doseq [item (countrys_cities :germany)] (println item))
View cities.clj
(def cities {
:germany ["Berlin" "Frankfurt" "Munich" "Bremerhaven" "Hamburg" "Leipzig"]
:france ["Paris" "Nice" "Marsaille" "Chartres" "Strasbourg" "Bordeaux"]
:italy ["Rome" "Naples" "Florence" "Milan" "Venice" "Genoa" "Bologna"]})
(defn countrys_cities [country] (country cities))
(doseq [item (countrys_cities :germany)] (println item))
(println "*****")
View as400db.clj
(ns test.core
(:require [clojure.java.jdbc :as sql]))
(def db-spec {
:classname "com.ibm.as400.access.AS400JDBCDriver"
:subprotocol "as400"
:subname "//machine-name/db-name"
:user "me"
:password "secret"})
View boomers.js
const generations = [['baby boomer', 60],
['gen x', 50],
['millenial', 35]];
const genInfo = generations.map( genArray => ((
{
name: genArray[0],
age: genArray[1]
}
)));
View bills3.js
var _ = require("underscore");
var billArray = [['name', 'age', 'job'],
['Bill Gates', 61, 'retired CEO'],
['Bill Murray', 75, 'retired actor'],
['Bill Clinton', 73, 'retired politician']];
var bills = [];
bills = _.each(_.rest(billArray), function(e) {