Keywords: Java, JDK (Java Development Kit), MacOS, Homebrew, Specific Version
This how-to guide covers how to install different versions of the JDK on MacOS with Homebrew.
Keywords: Java, JDK (Java Development Kit), MacOS, Homebrew, Specific Version
This how-to guide covers how to install different versions of the JDK on MacOS with Homebrew.
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
# My take on Mike's source_for method. | |
# (see http://pragmaticstudio.com/blog/2013/2/13/view-source-ruby-methods) | |
# | |
# (1) I named it 'src' rather than source_for (ok, I'm a lazy typer). | |
# (2) The edit function was broken out as a separate function. | |
# (3) The edit function is for emacs | |
# (4) If the method is not defined on the object, and the object | |
# is a class, then see if it is an instance method on the class. | |
# | |
# The fourth point allows my to say: |
You can terminate the sqlite3 program by typing your systems End-Of-File character (usually a Control-D). | |
Use the interrupt character (usually a Control-C) to stop a long-running SQL statement. | |
https://sqlite.org/cli.html | |
SQLite version 3.28.0 2019-04-15 14:49:49 | |
Enter ".help" for usage hints. | |
sqlite> .help | |
.auth ON|OFF Show authorizer callbacks | |
.backup ?DB? FILE Backup DB (default "main") to FILE |
Help | |
help Show a list of commands or information about a specific command. | |
Context | |
cd Move into a new context (object or scope). | |
find-method Recursively search for a method within a class/module or the current namespace. | |
ls Show the list of vars and methods in the current scope. | |
pry-backtrace Show the backtrace for the pry session. | |
raise-up Raise an exception out of the current pry instance. | |
reset Reset the repl to a clean state. |
#!/usr/bin/env node | |
// COMMAND: ./use_npm_lock_versions.js ~/path/to/your/repo | |
const fs = require('fs'); | |
const os = require('os'); | |
function init() { | |
const directory = parseDirectory(process.argv.slice(2)[0]); | |
const [packageJson, newlineCharacter] = loadPackageJson(directory); |
// MIN_LEVEL = 5 | |
// MAX_LEVEL = 15 | |
// Light Switch | Brightnesses for given Bulb Capacity | |
// Dimmer Level | 5 Watt | 10 Watt | 20 Watt | |
// 5 | 0 | 0 | 0 | |
// 15 | 5 | 10 | 20 | |
// 10 | 2.5 | 5 | 10 |
// Today, the bookstore owner has a store open for customers.length minutes. | |
// Every minute, some number of customers (customers[i]) enter the store, and all those customers leave after the end of that minute. | |
// On some minutes, the bookstore owner is grumpy. | |
// If the bookstore owner is grumpy on the i-th minute, grumpy[i] = 1, otherwise grumpy[i] = 0. | |
// When the bookstore owner is grumpy, the customers of that minute are not satisfied, otherwise they are satisfied. | |
// The bookstore owner knows a secret technique to keep themselves not grumpy for X minutes straight, but can only use it once. | |
// Return the maximum number of customers that can be satisfied throughout the day. | |
function maximizeCustomerSatisfaction(customers, grumpy, x) { | |
const combinations = generateGrumpyCombinations(grumpy, x); |
// find two numbers whose sum equals the target_sum value | |
function create_digits(numbers) { | |
const digits = {}; | |
for (let i = 0; i < numbers.length; i++) { | |
digits[numbers[i]] = 1; | |
} | |
return digits; | |
} |
#!/usr/bin/env python3 | |
# Given a 2D grid map of 1s (land) and 0s (water), count the number of islands. | |
# An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. | |
# You may assume the grid itself is surrounded by water. | |
# https://www.geeksforgeeks.org/find-number-of-islands/ | |
# https://www.geeksforgeeks.org/find-the-number-of-distinct-islands-in-a-2d-matrix/ | |
# https://stackoverflow.com/questions/58767533/find-explicitly-islands-in-matrix | |
# http://www.huristic.co/blog/2016/10/14/finding-islands-in-an-adjacency-matrix |